mangum icon indicating copy to clipboard operation
mangum copied to clipboard

Allow Mangum to remove certain aws reponse headers from api gateway response

Open amieka opened this issue 2 years ago • 2 comments

Problem: Currently Mangum injects the following headers in the api gateway response for an aws lambda integration

x-amz-apigw-id
x-amzn-requestid 
x-amzn-trace-id

This exposes additional information that the client doesn't need to know.

Proposal:

Allow Mangum to take optional parameter say exclude_header_keys=[] at the application mounting step.

An Example of that would look like.


from fastapi import FastAPI

app = FastAPI()

handler = Mangum(app, exclude_header_keys=[]

amieka avatar Sep 30 '21 17:09 amieka

Hi @amieka,

I've given this some thought and decided it should okay to include this new parameter - let's go with a new parameter named exclude_headers.

Would you be able to create a PR?

jordaneremieff avatar Oct 17 '21 10:10 jordaneremieff

Hi @jordaneremieff I can take a stab it. Thank you

amieka avatar Oct 17 '21 18:10 amieka