Verified Commit 75975ceb authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Added proper CORS header

parent 4705a8eb
...@@ -11,7 +11,10 @@ async def json_response(self, status, content): ...@@ -11,7 +11,10 @@ async def json_response(self, status, content):
await self.send_response( await self.send_response(
status, status,
json.dumps(content, indent=2, sort_keys=True).encode("utf-8"), json.dumps(content, indent=2, sort_keys=True).encode("utf-8"),
headers=[(b"Content-Type", b"application/json")], headers=[
(b"Content-Type", b"application/json"),
(b"Access-Control-Allow-Origin", b"*"),
],
) )
......
...@@ -20,5 +20,8 @@ async def test_search_consumer_success(loop, application, mocker, coroutine_mock ...@@ -20,5 +20,8 @@ async def test_search_consumer_success(loop, application, mocker, coroutine_mock
"webfinger", "test@user.domain", get.return_value "webfinger", "test@user.domain", get.return_value
) )
assert response["status"] == 200 assert response["status"] == 200
assert response["headers"] == [(b"Content-Type", b"application/json")] assert response["headers"] == [
(b"Content-Type", b"application/json"),
(b"Access-Control-Allow-Origin", b"*"),
]
assert response["body"] == json.dumps(expected, indent=2, sort_keys=True).encode() assert response["body"] == json.dumps(expected, indent=2, sort_keys=True).encode()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment