Skip to content

Content-Length header is ignored in web.Response constructor #1400

Closed
@major12

Description

Long story short

Header Content-Length is ignored in web.Response constructor.
It is set to 0 when body parameter is not passed to constructor.

Expected behaviour

Either to get warning like "your header was ignored" or to have it not ignored.

Actual behaviour

Header value is silently updated.

Steps to reproduce

>>> headers = {'Content-Length':555}
>>> r = web.Response(headers=headers)
>>> r.headers
<CIMultiDict('Content-Type': 'application/octet-stream', 'Content-Length': '0')>

Your environment

aiohttp (1.1.3)
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Win10

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions