See #192: use proper content type for nodeinfo endpoint
This commit is contained in:
parent
a679f48fcf
commit
095b70db4b
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue