You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when a client sets their own
`x-amzn-{lambda,request}-context` headers, they will be included in the
request to the app server.
This request to the lambda with the adapter installed:
```
$ curl -H "x-amzn-request-context: boom" http://localhost:8000
```
Will result in this request from the adapter to the app server:
```
GET / HTTP/1.1
[...]
x-amzn-request-context: boom
x-amzn-request-context: [json context from adapter]
x-amzn-lambda-context: [json context from adapter]
[...]
```
Many implementations of web frameworks will take the *first* header when
you access a header key.
For example, Starlette/FastAPI does this:
https://github.com/encode/starlette/blob/ad02ee6336faadadf97e0c79dd3a91759f1f32a7/starlette/datastructures.py#L562-L567
This patch overrides every user-set `x-amzn-{request,lambda}-context`
headers from the request by JSON context headers from the adapter.
Signed-off-by: Thitat Auareesuksakul <[email protected]>
0 commit comments