The headers with same key are overwritten
See original GitHub issueStarlette responses adds cookies as headers with the same key.
self.raw_headers.append((b"set-cookie", cookie_val.encode("latin-1")))
In your middleware handle outgoing request over writes the same key with only the last value.
async def handle_outgoing_request(message: Message) -> None:
if message['type'] == 'http.response.start':
headers = {k.decode(): v.decode() for (k, v) in message['headers']}
headers[self.header_name] = correlation_id.get()
headers['Access-Control-Expose-Headers'] = self.header_name
response_headers = Headers(headers=headers)
message['headers'] = response_headers.raw
await send(message)
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
23. Overwrite values of headers with same name in ... - YouTube
Hi All, Rest Assured will by default merge values of headers with the same name which I have shown in the last video....
Read more >HTTP response headers with the same key are not processed ...
HTTP response headers with the same key are not processed properly. [The expected behaviour is that the values of the identical keys are...
Read more >HttpRequestMessage multiple custom headers overwriting ...
It seems the "Accept" header is reserved. No matter what value I tried to assign to it a FormatException was thrown.
Read more >Luks header overwritten with dd - Super User
I'm really sorry, but the LUKS header contains the passphrase-encrypted key(s) which unlock everything else. Without a backup copy of the header ......
Read more >Headers.set() - Web APIs - MDN Web Docs - Mozilla
overwrites the existing value with the new one, whereas Headers. append appends the new value to the end of the set of values....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://github.com/snok/asgi-correlation-id/pull/25
v1.1.3 should be out within the next minute, so will consider this closed 👍