mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-30 12:59:39 +08:00
bugfix: POST content-type is application/x-www-form-urlencoded
This commit is contained in:
@@ -70,3 +70,21 @@ class TestHttpClient(ApiServerUnittest):
|
||||
}
|
||||
setup_hook_prepare_kwargs(request)
|
||||
self.assertIsInstance(request["data"], bytes)
|
||||
|
||||
def test_prepare_kwargs_content_type_x_www_form_urlencoded(self):
|
||||
request = {
|
||||
"url": "/path",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"content-type": "application/x-www-form-urlencoded; charset=utf-8"
|
||||
},
|
||||
"data": {
|
||||
"a": 1,
|
||||
"b": 2
|
||||
}
|
||||
}
|
||||
setup_hook_prepare_kwargs(request)
|
||||
self.assertIsInstance(request["data"], bytes)
|
||||
self.assertIn(b'a=1', request["data"])
|
||||
self.assertIn(b'&', request["data"])
|
||||
self.assertIn(b'b=2', request["data"])
|
||||
|
||||
Reference in New Issue
Block a user