Skip to content
Myr

Make sure newlines at chunk borders do not get dropped using iter_lines.

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

authored by Chase Sterling · committed by Chase Sterling · parent 95911f0 · Browse files · 1 file+3 added−3 removed
This commit

State

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

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:requests/models.py+3 added-3 removed
634 unmodified lines
635 pending = None636 for chunk in self.iter_content(chunk_size, decode_unicode=decode_unicode):637 if pending is not None:638 chunk = pending + chunk639 lines = chunk.splitlines()639 lines = chunk.splitlines(True)640 for line in lines[:-1]:641 yield line641 yield line.rstrip()642 # Save the last part of the chunk for next iteration, to keep full line together643 pending = lines[-1]644645 # Yield the last line646 if pending is not None:647 yield pending647 yield pending.rstrip()648649650 @property651 def content(self):
54 unmodified lines