See #192: use proper content type for nodeinfo endpoint

merge-requests/237/head
Eliot Berriot 2018-05-07 23:29:07 +02:00
rodzic a679f48fcf
commit 095b70db4b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
2 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -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)

Wyświetl plik

@ -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