Skip to content

when setting the Accept-Encoding header to None, it is still sent as 'identity' #2234

Closed
@vdanen

Description

I am passing these headers to request:

headers = {'Content-Type': 'application/something+xml',
'Accept': 'application/something+xml',
'Host': host,
'Expect': '100-continue',
'Connection': None,
'Accept-Encoding': None}

and then using:

r = requests.put(my_url, data=strata_xml, headers=headers, auth=(user, pwd), verify=False)

the REST service on the other end does not like this header at all. Using nc, I see it sending:

PUT /myurl HTTP/1.1
Accept-Encoding: identity
Content-Length: 1200
Accept: application/something+xml
User-Agent: python-requests/2.4.1 CPython/2.7.8 Darwin/13.3.0
Host: localhost
Expect: 100-continue
Content-Type: application/something+xml

I believe that https://hg.python.org/cpython/file/d047928ae3f6/Lib/http/client.py#l1086 may offer some clue there as to why this header is not being deleted when I set it to None, but I don't know how to work-around that.

Thanks.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions