aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.67k stars 1.01k forks source link

Chalice does not respect authorizer header argument locally #1976

Open saedx1 opened 2 years ago

saedx1 commented 2 years ago

Hi,

I've noticed that if you specify a header for the authorizer and try it locally it won't work; it will still check for the Authorization header rather than the header I specified.

Example:

@app.authorizer(header="Cookie")
def authorizer(auth_request):
    token = auth_request.token

Here, it will not respect "Cookie" and use it as the header for authorization. It will still go for "Authorization".

I dug a little bit, and it turned out that it's fixed to Authorization in the code itself.

The behavior is correct when you deploy; the problem is only present locally.

I'm making a PR to create a fix for it.

Thanks