From 408bbd81aaaef74a3d45e8e8adba6a1c1dd281c1 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Sat, 14 Jul 2018 23:55:21 +0200 Subject: [PATCH] Fix map/id/geojson content_type --- umap/models.py | 1 - umap/tests/test_map_views.py | 1 + umap/views.py | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/umap/models.py b/umap/models.py index fddc0958..6197ef38 100644 --- a/umap/models.py +++ b/umap/models.py @@ -6,7 +6,6 @@ from django.conf import settings from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.core.signing import Signer -from django.contrib import messages from django.template.defaultfilters import slugify from django.core.files.base import File diff --git a/umap/tests/test_map_views.py b/umap/tests/test_map_views.py index 70e8fa00..9069f3e6 100644 --- a/umap/tests/test_map_views.py +++ b/umap/tests/test_map_views.py @@ -264,6 +264,7 @@ def test_map_geojson_view(client, map): url = reverse('map_geojson', args=(map.pk, )) response = client.get(url) j = json.loads(response.content.decode()) + assert 'json' in response['content-type'] assert 'type' in j diff --git a/umap/views.py b/umap/views.py index 3c91e54a..922ccb68 100644 --- a/umap/views.py +++ b/umap/views.py @@ -486,7 +486,8 @@ class MapViewGeoJSON(MapView): return reverse('map_geojson', args=(self.object.pk, )) def render_to_response(self, context, *args, **kwargs): - return HttpResponse(context['map_settings']) + return HttpResponse(context['map_settings'], + content_type='application/json') class MapNew(MapDetailMixin, TemplateView):