Skip to content
Myr

Fail silently if encoding header is missing

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 41876fd · Browse files · 2 files+5 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−1 removed

  • other:+5 added−1 removed

2 files+5 added−1 removed

modified:requests/utils.py+5 added
179 unmodified lines
180181def stream_decode_response_unicode(iterator, r):182 """Stream decodes a iterator."""183 encoding = get_encoding_from_headers(r.headers)184 if encoding is None:185 for item in iterator:186 yield item187 return188189 decoder = codecs.getincrementaldecoder(encoding)(errors='replace')190 for chunk in iterator:191 rv = decoder.decode(chunk)192 if rv:
62 unmodified lines
modified:test_requests.py-1 removed
475 unmodified lines
476 assert heads['User-agent'] in r2.content477 self.assertEqual(r2.status_code, 200)478479480480if __name__ == '__main__':481 unittest.main()