Skip to content

Commit 5e9045c

Browse files
committed
feat: Set Access-Control-Allow-Origin * on API, #268
1 parent e769b9b commit 5e9045c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

data_registry/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ def publications_api(request):
220220
)
221221
)
222222
return JsonResponse(
223-
list(publications), safe=False, json_dumps_params={"ensure_ascii": False, "separators": (",", ":")}
223+
list(publications),
224+
safe=False, # safe=True requires dict
225+
json_dumps_params={"ensure_ascii": False, "separators": (",", ":")},
226+
content_type="application/json; charset=utf-8", # some browsers assume incorrect charset
227+
headers={"Access-Control-Allow-Origin": "*"},
224228
)
225229

226230

0 commit comments

Comments
 (0)