Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple response headers with same name combined to a single comma-separated list #1413

Open
2 tasks done
stuartio opened this issue Jun 13, 2022 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working new Needs triage. Comments are welcome!

Comments

@stuartio
Copy link

Checklist

  • I've searched for similar issues.
  • I'm using the latest version of HTTPie.

Minimal reproduction code and steps

  1. Request from any endpoint which produces multiple response headers with the same name

Current result

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 2
Content-Type: text/plain
Date: Mon, 13 Jun 2022 11:17:01 GMT
Server: nginx/1.22.0
edge-cache-tag: origin.stuartmacleod.net-2022-06-13T11-17-01.933Z
not-edge-cache-tag: origin.stuartmacleod.net-2022-06-13T11-17-01.933Z
testheader: 1, 2, 3

Expected result

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 2
Content-Type: text/plain
Date: Mon, 13 Jun 2022 11:17:01 GMT
Server: nginx/1.22.0
edge-cache-tag: origin.stuartmacleod.net-2022-06-13T11-17-01.933Z
not-edge-cache-tag: origin.stuartmacleod.net-2022-06-13T11-17-01.933Z
testheader: 1
testheader: 2
testheader: 3

Debug output

PS C:\code> http https://origin.stuartmacleod.net/httpie --debug
HTTPie 3.2.1
Requests 2.27.1
Pygments 2.11.2
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
C:\code\Python\Python38\python.exe
Windows 10

<Environment {'apply_warnings_filter': <function Environment.apply_warnings_filter at 0x000001EC361D6310>,
'args': Namespace(),
'as_silent': <function Environment.as_silent at 0x000001EC361D61F0>,
'colors': 256,
'config': {'default_options': ['--style=xcode']},
'config_dir': WindowsPath('C:/Users/Stuart/AppData/Roaming/httpie'),
'devnull': <property object at 0x000001EC3616B4A0>,
'is_windows': True,
'log_error': <function Environment.log_error at 0x000001EC361D6280>,
'program_name': 'http',
'quiet': 0,
'rich_console': <functools.cached_property object at 0x000001EC36168E20>,
'rich_error_console': <functools.cached_property object at 0x000001EC361764C0>,
'show_displays': True,
'stderr': <colorama.ansitowin32.StreamWrapper object at 0x000001EC36148E50>,
'stderr_isatty': True,
'stdin': <_io.TextIOWrapper name='' mode='r' encoding='utf-8'>,
'stdin_encoding': 'utf-8',
'stdin_isatty': True,
'stdout': <colorama.ansitowin32.StreamWrapper object at 0x000001EC3612FFA0>,
'stdout_encoding': 'utf-8',
'stdout_isatty': True}>

<PluginManager {'adapters': [],
'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>,
<class 'httpie.plugins.builtin.DigestAuthPlugin'>,
<class 'httpie.plugins.builtin.BearerAuthPlugin'>],
'converters': [],
'formatters': [<class 'httpie.output.formatters.headers.HeadersFormatter'>,
<class 'httpie.output.formatters.json.JSONFormatter'>,
<class 'httpie.output.formatters.xml.XMLFormatter'>,
<class 'httpie.output.formatters.colors.ColorFormatter'>]}>

requests.request(**{'auth': None,
'data': RequestJSONDataDict(),
'headers': <HTTPHeadersDict('User-Agent': b'HTTPie/3.2.1')>,
'method': 'get',
'params': <generator object MultiValueOrderedDict.items at 0x000001EC36543200>,
'url': 'https://origin.stuartmacleod.net/httpie'})

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 2
Content-Type: text/plain
Date: Mon, 13 Jun 2022 11:18:15 GMT
Server: nginx/1.22.0
edge-cache-tag: origin.stuartmacleod.net-2022-06-13T11-18-15.040Z
not-edge-cache-tag: origin.stuartmacleod.net-2022-06-13T11-18-15.040Z
testheader: 1, 2, 3

ok

Additional information, screenshots, or code examples

This behaviour was changed after version 2.4.0. With 2.4.0 and earlier it outputs as expected, so I assume this was a deliberate move. If so, is there an option to use the previous output behaviour I could add to my config.json?

@stuartio stuartio added bug Something isn't working new Needs triage. Comments are welcome! labels Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new Needs triage. Comments are welcome!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant