Conversation
thrau
left a comment
There was a problem hiding this comment.
thanks for verifying this behavior. when i wrote this, i checked the RFCs related to header handling and multi-value headers are typically expected to be returned as a CSV list, but good to know that twisted handles things differently internally (and makes sense).
should have written a test for it though!
changes LGTM!
I mean, it's technically correct, it's just that AWS does not concatenate them, so for LocalStack it is an issue. There's also the Thanks for the merge, I'll do a release later today 👍 |
Motivation
Follow-up from #34, we had the wrong behavior for multivalue header handling. We were joining the multivalues in one line, where we need a single line per header value, with duplicated keys.
This is due to how Twisted changed how it returns headers: previous versions were returning
key, valuefrom iterating over headers, where the samekeycould appear multiple times (similar to how Werkzeug Headers works).The new implementation now returns a dictionary of lists, so we need to keep the same logic as before by creating a line for each value in the list.
Technically, this is correct to concatenate them if they can be concatenated, but some clients expects them differently (and for LocalStack usage, AWS does not concatenate them).
See also the following SO response: https://stackoverflow.com/a/3097052/21356283
And the RFC 2616:
Changes