Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
retribute.me
api
Commits
75975ceb
Verified
Commit
75975ceb
authored
Jun 04, 2019
by
Eliot Berriot
Browse files
Added proper CORS header
parent
4705a8eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
retribute_api/search/consumers.py
View file @
75975ceb
...
@@ -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
"*"
),
],
)
)
...
...
tests/search/test_consumers.py
View file @
75975ceb
...
@@ -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
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment