diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-12-03 19:07:37 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-12-03 20:10:13 +0200 |
commit | dd250d5a64d81ed247ce8e19fc300feaaa1e44c9 (patch) | |
tree | 2f68dca430b3b59bec96e16044da98396aa83523 /ick2/responses.py | |
parent | 33f0993dee800919517e676274562dfbf10b5b60 (diff) | |
download | ick2-dd250d5a64d81ed247ce8e19fc300feaaa1e44c9.tar.gz |
Add: OK response with custom headers
Diffstat (limited to 'ick2/responses.py')
-rw-r--r-- | ick2/responses.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ick2/responses.py b/ick2/responses.py index 1ceae52..f0c5c8f 100644 --- a/ick2/responses.py +++ b/ick2/responses.py @@ -25,10 +25,11 @@ def response(status_code, body, headers): # pragma: no cover return apifw.Response(obj) -def OK(body): # pragma: no cover - headers = { - 'Content-Type': 'application/json', - } +def OK(body, headers=None): # pragma: no cover + if headers is None: + headers = {} + elif 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' return response(apifw.HTTP_OK, body, headers) |