-
Notifications
You must be signed in to change notification settings - Fork 327
Open
Description
When I use httpie, you can see data is a byte-literal string:
# printf '{"username": "admin", "password": "YWRtaW4=", "timeout": 60}' | http POST http://localhost/api/Login Accept:'application/json' Content-Type:'application/json' --debug
...
>>> requests.request(**{'auth': None,
'data': b'{"username": "admin", "password": "YWRtaW4=", "timeout": 60}',
'headers': {'User-Agent': b'HTTPie/2.4.0', 'Accept': b'application/json', 'Content-Type': b'application/json'},
'method': 'post',
'params': <generator object MultiValueOrderedDict.items at 0x7f7c8bdfde08>,
'url': 'http://localhost/api/Login'})
The above successfully authenticates. When I do the equivalent (as best I can tell) in http-prompt, however:
# http-prompt localhost --debug
Version: 2.1.0
http://localhost> cd api/Login
http://localhost/api/Login> Accept:application/json
http://localhost/api/Login> Content-Type:application/json
http://localhost/api/Login> username='admin'
http://localhost/api/Login> password='YWRtaW4='
http://localhost/api/Login> timeout=60
http://localhost/api/Login> post
...
>>> requests.request(**{'auth': None,
'data': '{"password": "YWRtaW4=", "timeout": "60", "username": "admin"}',
'headers': {'User-Agent': b'HTTPie/2.4.0', 'Accept': b'application/json', 'Content-Type': b'application/json'},
'method': 'post',
'params': <generator object MultiValueOrderedDict.items at 0x7f554bb2e678>,
'url': 'http://localhost/api/Login'})
Here the 'b' is missing at the start of the data value and I get "Request body is empty or format is invalid." Is this something I can control or is it a limitation of http-prompt?
Metadata
Metadata
Assignees
Labels
No labels