Skip to content
Snippets Groups Projects
Verified Commit 095b70db authored by Eliot Berriot's avatar Eliot Berriot
Browse files

See #192: use proper content type for nodeinfo endpoint

parent a679f48f
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,11 @@ from . import nodeinfo
from . import stats
NODEINFO_2_CONTENT_TYPE = (
'application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8' # noqa
)
class InstanceSettings(views.APIView):
permission_classes = []
authentication_classes = []
......@@ -38,4 +43,5 @@ class NodeInfo(views.APIView):
if not preferences.get('instance__nodeinfo_enabled'):
return Response(status=404)
data = nodeinfo.get()
return Response(data, status=200)
return Response(
data, status=200, content_type=NODEINFO_2_CONTENT_TYPE)
......@@ -9,8 +9,9 @@ def test_nodeinfo_endpoint(db, api_client, mocker):
'funkwhale_api.instance.nodeinfo.get', return_value=payload)
url = reverse('api:v1:instance:nodeinfo-2.0')
response = api_client.get(url)
ct = 'application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8' # noqa
assert response.status_code == 200
assert response['Content-Type'] == ct
assert response.data == payload
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment