-
Notifications
You must be signed in to change notification settings - Fork 203
Singleton Headers (such as User-Agent) are separated at comma when using httpadapter.NewV2 #178
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
Comments
fix(requestv2): fixes multiton/singleton header parsing (#178)
I am noticing that the
So, it the fix might not include this scenario. Using Confirmed by looking at the raw headers that
I can re-join for now, but this is still a bug then. |
I'm running into this issue with the stripe signature header also. This is how I worked around it: signatureHeader := strings.Join(r.Header["Stripe-Signature"], ",") |
Bug
Description
When using
*httpadapter.HandlerAdapterV2
to proxy aevents.APIGatewayV2HTTPRequest
, single-value headers, such asUser-Agent
,Authorization
, etc. which may contain commas in their value, are cut into multiplehttp.Header
values when proxying. This leads to strange behaviour with methods like*http.Request.UserAgent()
, which results in a cut-offUser-Agent
.Reproduction
Fix
Firstly, in
*RequestAccessorV2.EventToRequest
one should split the header fields into single-value (singleton) headers and multi-value capabale (multitons) headers. Then parse the singletons as a single value and the multitons as a comma separted list. This fix has been implemented, see !179. I have usedmozilla's list for singleton headers, as well as
net/textproto.CanonicalMIMEHeaderKey
to make the singleton-multiton-split case-insensitive. Test cases have also been added (disclaimer: its the first time for me to use ginkgo, hopefully what I did is correct).The text was updated successfully, but these errors were encountered: