summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Nelzin <asnelzin@gmail.com>2014-11-12 15:23:23 +0300
committerAlexander Nelzin <asnelzin@gmail.com>2014-11-12 15:23:23 +0300
commit34f6088c8f3f2bac942c84ce2ffa92dfdee5aa4e (patch)
treeff3c81075ffa14d3b01ae05a60e1c0467fcdd328
parent431282e77888e6601991d8c1e2481b3692f4194a (diff)
downloadpython-requests-34f6088c8f3f2bac942c84ce2ffa92dfdee5aa4e.tar.gz
Added test for overriding Content-Length.
-rwxr-xr-xtest_requests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test_requests.py b/test_requests.py
index b2e12d06..4a05cb2e 100755
--- a/test_requests.py
+++ b/test_requests.py
@@ -103,6 +103,14 @@ class RequestsTestCase(unittest.TestCase):
head_req = requests.Request('HEAD', httpbin('head')).prepare()
assert 'Content-Length' not in head_req.headers
+ def test_override_content_length(self):
+ headers = {
+ 'Content-Length': 'not zero'
+ }
+ r = requests.Request('POST', httpbin('post'), headers=headers).prepare()
+ assert 'Content-Length' in r.headers
+ assert r.headers['Content-Length'] == 'not zero'
+
def test_path_is_not_double_encoded(self):
request = requests.Request('GET', "http://0.0.0.0/get/test case").prepare()