mirror of
https://github.com/httpie/cli.git
synced 2024-12-24 15:29:03 +01:00
parent
284a75fa2f
commit
cbc6d02127
@ -25,6 +25,10 @@ def from_request(request):
|
||||
# requests < 0.12.1
|
||||
body = request._enc_data
|
||||
|
||||
if isinstance(body, dict):
|
||||
# --form
|
||||
body = request.__class__._encode_params(body)
|
||||
|
||||
return HTTPMessage(
|
||||
line='{method} {path} HTTP/1.1'.format(
|
||||
method=request.method,
|
||||
|
@ -122,6 +122,11 @@ class TestHTTPie(BaseTest):
|
||||
r = http('--verbose', 'GET', 'http://httpbin.org/get', 'test-header:__test__')
|
||||
self.assertEqual(r.count('__test__'), 2)
|
||||
|
||||
def test_verbose_form(self):
|
||||
# https://github.com/jkbr/httpie/issues/53
|
||||
r = http('--verbose', '--form', 'POST', 'http://httpbin.org/post', 'foo=bar', 'baz=bar')
|
||||
self.assertIn('foo=bar&baz=bar', r)
|
||||
|
||||
def test_json(self):
|
||||
response = http('POST', 'http://httpbin.org/post', 'foo=bar')
|
||||
self.assertIn('"foo": "bar"', response)
|
||||
|
Loading…
Reference in New Issue
Block a user