Intermediate requests are being printed if `--print=H` flag is used
Checklist
- [x] I've searched for similar issues.
- [x] I'm using the the latest version of HTTPie.
What are the steps to reproduce the problem?
Run http --follow --print=H pie.dev/redirect/3
What is the expected result?
I should only see the ~~last~~ first request header
What happens instead?
Intermediate request headers are shown but there is no mention in the docs that --print implies --all
Debug output
Please re-run the command with --debug, then copy the entire command & output and paste both below:
$ http --debug --follow --print=H pie.dev/redirect/3
HTTPie 2.4.0
Requests 2.22.0
Pygments 2.7.2
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0]
/usr/bin/python3
Linux 4.19.104-microsoft-standard
<Environment {'colors': 256,
'config': {'__meta__': {'about': 'HTTPie configuration file',
'help': 'https://httpie.org/doc#config',
'httpie': '1.0.3'},
'default_options': []},
'config_dir': PosixPath('/home/ducaale/.httpie'),
'devnull': <property object at 0x7fab34b27bd0>,
'is_windows': False,
'log_error': <function Environment.log_error at 0x7fab34b29d30>,
'program_name': 'http',
'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
'stderr_isatty': True,
'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>,
'stdin_encoding': 'utf-8',
'stdin_isatty': True,
'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>,
'stdout_encoding': 'utf-8',
'stdout_isatty': True}>
>>> requests.request(**{'auth': None,
'data': RequestJSONDataDict(),
'headers': {'User-Agent': b'HTTPie/2.4.0'},
'method': 'get',
'params': <generator object MultiValueOrderedDict.items at 0x7fab34a9dba0>,
'url': 'http://pie.dev/redirect/3'})
GET /redirect/3 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: pie.dev
User-Agent: HTTPie/2.4.0
GET /relative-redirect/2 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: pie.dev
User-Agent: HTTPie/2.4.0
GET /relative-redirect/1 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: pie.dev
User-Agent: HTTPie/2.4.0
GET /get HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: pie.dev
User-Agent: HTTPie/2.4.0
Provide any additional information, screenshots, or code examples below: N/A
Hello @ducaale,
Thanks for the report.
After digging into the issue, it appears to be a little bit complicated to handle that scenario. I do not say we will not fix it, but it requires to adapt how requests are printed and we like the way it is as of now: streamed in real-time. I simply added a reproduction test case with 9792513c6878a410fe7645810668f820100b5eea and delayed the work on a potential solution for now because we have more important priorities.
Just keep the issue open and we will come back in the future with a solution :)
I should only see the last request header
Hm, would you expect to only see the last request? That's how --all is documented, but seeing only the first request and the final response is what I'd intuitively expect.
(Context: we're implementing --all in ducaale/xh#137 and aren't sure about the correct behavior)
seeing only the first request and the final response is what I'd intuitively expect.
This is how https://github.com/ducaale/xh/pull/137 is currently being implemented
- By default, the first request and last response are printable
--allcan mark intermediate responses and requests as printable--printaffects any request and response that is marked as printable--history-printaffects intermediate requests and responses which are marked as printable--verboseimplies--all
I am not sure why I said last request instead of first request in the bug report .