HTTPie feature parity checklist
- [x] Support
=@and:=@as seperators in request data. - [x] Support
==@and:@for reading query string and header values from a file (#288) - [x] Support specifying file type in multipart requests i.e
key@file_name;type=file_type. - [x] Support
--response-charsetand--response-mimeflags. (#184) - [ ] Support custom boundary in multipart requests (currently not supported in reqwest).
- [x] Support unsetting headers + empty headers.
- [x] Support reading request body from stdin.
- [x] Support
--rawflag (#202) - [x] Support reading request data from a file.
- [x] Support piping response body to stdout (including binary).
- [x] Support unbuffered streamed responses.
- [x] Support Download mode.
- [x] Support resuming interrupted downloads
- [x] Support Sessions. (#125)
- [x] Support
HEADHTTP method. - [x] Support
--allflag for printing intermediary requests/responses. (#137) - [x] Support
--history-print. (#137) - [x] Support the
--timeoutflag. - [x] Support default options (#165)
- [ ] Support the
--path-as-isflag - [x] Decode responses compressed in deflate format. (#158)
- [ ] Support
--compressflag (#403). - [ ] Support
--chunkedflag. - [x] Support
-vv/--metaflags. (#240) - [x] Add Monokai theme. (#157)
- [x] Add Fruity theme. (#206)
- [x] Support Digest authentication. (#176)
- [ ] (undecided) Warn the user when there is no incoming data after a certain time passed on stdin.
httpie uses the value of environment variable REQUESTS_CA_BUNDLE to verify if it is present.
Would be nice if xh uses it too.
It doesn't seem to be mentioned in the docs but it is, in fact, something that HTTPie supports.
The library we use for parsing command-line arguments supports falling back to an env variable so this should be an easy one to implement. Would like to create a PR for it?
Edit: this has been implemented in https://github.com/ducaale/xh/pull/146
requests checks both REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE, so perhaps we should also look for both.
So this means we can no longer use the nice API that structopt offers. If that is the case, we should manually check for those env variables inside the from_iter_safe() function and then set cli.verify from there.
xh does not process query parameter read from file as httpie does:
Prepare a file with value for query parameter
First we create a file with a value to use:
$ echo "filed-value" > arg.value
Use http, reading query parameter from the file
Then using http we ask to use this value read from the file for query parameter arg:
$ http https://httpbin.org/get [email protected]
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 342
Content-Type: application/json
Date: Wed, 05 Oct 2022 23:11:13 GMT
Server: gunicorn/19.9.0
{
"args": {
"arg": "filed-value"
},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Host": "httpbin.org",
"User-Agent": "HTTPie/3.2.1",
"X-Amzn-Trace-Id": "Root=1-633e0f11-6265bd27088a85585daa3a5d"
},
"origin": "185.151.252.82",
"url": "https://httpbin.org/get?arg=filed-value"
}
As we can see, the response report the value for arg is "filed-value" as expected.
Use xh to read the query parameter from the file - fails with using the file name
Now try the same with xh:
$ xh https://httpbin.org/get [email protected]
HTTP/2.0 200 OK
access-control-allow-credentials: true
access-control-allow-origin: *
content-length: 343
content-type: application/json
date: Wed, 05 Oct 2022 23:11:31 GMT
server: gunicorn/19.9.0
{
"args": {
"arg": "@arg.value"
},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Host": "httpbin.org",
"User-Agent": "xh/0.16.1",
"X-Amzn-Trace-Id": "Root=1-633e0f23-1fbbb3d05048db3a7649a622"
},
"origin": "185.151.252.82",
"url": "https://httpbin.org/get?arg=%40arg.value"
}
As can be seen, it did not read the value from the file, instead it used value of the file itself.
Thanks, @vlcinsky. I have now included this in the feature compatibility checklist.
For reference, https://github.com/httpie/httpie/pull/1225 is the PR that added support for reading header and query string values from a file.
@ducaale great.
Just a note: http does urlencoding for the values read from the file before putting it into final url string.