Skip to content

Flask request headers #1197

Closed
Closed
@csheppard

Description

Long story short

After upgrading to aiohttp-1.0.1 and multidict-2.1.0 I can no longer get values from flask.request.headers.

Reverting back to aiohttp==0.22.5 multidict==1.2.2 works fine.

Expected behaviour

print(request.headers.get('Host'))
myhost.name

print(request.headers['host'])
myhost.name

Actual behaviour

print(request.headers.get('Host'))
None

print(request.headers['host'])
  <snip>
  File "venv/lib/python3.5/site-packages/werkzeug/datastructures.py", line 1312, in __getitem__
    return _unicodify_header_value(self.environ['HTTP_' + key])
KeyError: 'HTTP_HOST'

Steps to reproduce

Viewing the data of request.headers.dict['environ'] reveals that the key is actually 'HTTP_Host' and not 'HTTP_HOST' as werkzeug is looking for.

Your environment

aiohttp (1.0.1)
Flask (0.11.1)
gunicorn (19.6.0)
multidict (2.1.0)
Werkzeug (0.11.11)

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions