summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2016-07-09 17:50:57 -0600
committerBert JW Regeer <bertjw@regeer.org>2016-07-16 20:23:28 -0600
commitb3ede28bf302888532afdab513d6de19ca371dc3 (patch)
tree8e5bd1a399230502293fe28fcccaf8064bd55d51 /tests
parent954d5c6cdae31af58b4d9a0376c35f6568429832 (diff)
downloadwebob-b3ede28bf302888532afdab513d6de19ca371dc3.tar.gz
On HTTP status codes without body, don't set content type
When using Request.get_response() the response from the application may contain a status code that does not allow for an message-body to be returned, in this case adding the content type header is not valid, and potentially changes the original response. Closes #205
Diffstat (limited to 'tests')
-rw-r--r--tests/test_response.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/test_response.py b/tests/test_response.py
index 8a90a79..4ebef19 100644
--- a/tests/test_response.py
+++ b/tests/test_response.py
@@ -143,6 +143,9 @@ def test_init_keeps_specified_charset_when_json():
expected = content_type
assert Response(content_type=content_type).headers['content-type'] == expected
+def test_init_doesnt_add_default_content_type_with_bodyless_status():
+ assert Response(status='204 No Content').content_type is None
+
def test_cookies():
res = Response()
# test unicode value