The keywords headers
value must be string or buffer?
If the keywords dnt
and upgrade-insecure-requests
value is string or buffer, it's right,but the value is int,it's wrong.Why is that?
Right:
'dnt': '1',
'upgrade-insecure-requests': '1',
Wrong:
'dnt': 1,
'upgrade-insecure-requests': 1,
Why?
@wut0n9 This behavioural change is not in v2.10.0, it's in the current master branch.
However, that's a real bug: #3366 has regressed this. @nateprewitt, are you interested in trying to update with a fix for this?
Headers should always have been string. I don't think this is a significant regression if a regression at all. We've always documented that header values should be strings.
Regardless of what we documented, this used to work and now it doesn't. We'll break a _lot_ of code if we don't change this back.
Yeah, I'll get right on this @Lukasa.
See also https://github.com/kennethreitz/requests/issues/865 and https://github.com/kennethreitz/requests/pull/866
I don't know how much a "lot" actually is in this case.
@sigmavirus24 has linked to the relevant earlier opinions, which suggest that actually we don't allow non-string header values. So that means this is not a bug: it was us making a revision that is within the scope of the API definition.
@Lukasa right, I'm frankly surprised this didn't break earlier. The meaning of non-bytes/str as a header value is undefined as far as I'm concerned.
Most helpful comment
Regardless of what we documented, this used to work and now it doesn't. We'll break a _lot_ of code if we don't change this back.