MCPcopy
hub / github.com/benoitc/gunicorn / match_readline

Method match_readline

tests/treq.py:189–209  ·  view source on GitHub ↗
(self, req, body, sizes)

Source from the content-addressed store, hash-verified

187 raise AssertionError("Read after body finished: %r" % data)
188
189 def match_readline(self, req, body, sizes):
190 data = self.szread(req.body.readline, sizes)
191 count = 1000
192 while body:
193 if body[:len(data)] != data:
194 raise AssertionError("Invalid data read: %r" % data)
195 if b'\n' in data[:-1]:
196 raise AssertionError("Embedded new line: %r" % data)
197 body = body[len(data):]
198 data = self.szread(req.body.readline, sizes)
199 if not data:
200 count -= 1
201 if count <= 0:
202 raise AssertionError("Apparent unexpected EOF")
203 if body:
204 raise AssertionError("Failed to read entire body: %r" % body)
205 elif data:
206 raise AssertionError("Read beyond expected body: %r" % data)
207 data = req.body.readline(sizes())
208 if data:
209 raise AssertionError("Read data after body finished: %r" % data)
210
211 def match_readlines(self, req, body, sizes):
212 """\

Callers

nothing calls this directly

Calls 2

szreadMethod · 0.95
readlineMethod · 0.45

Tested by

no test coverage detected