MCPcopy
hub / github.com/django/django / test_read_after_value

Method test_read_after_value

tests/requests_tests/tests.py:345–361  ·  view source on GitHub ↗

Reading from request is allowed after accessing request contents as POST or body.

(self)

Source from the content-addressed store, hash-verified

343 self.assertEqual(request.readline(), b"other=string")
344
345 def test_read_after_value(self):
346 """
347 Reading from request is allowed after accessing request contents as
348 POST or body.
349 """
350 payload = FakePayload("name=value")
351 request = WSGIRequest(
352 {
353 "REQUEST_METHOD": "POST",
354 "CONTENT_TYPE": "application/x-www-form-urlencoded",
355 "CONTENT_LENGTH": len(payload),
356 "wsgi.input": payload,
357 }
358 )
359 self.assertEqual(request.POST, {"name": ["value"]})
360 self.assertEqual(request.body, b"name=value")
361 self.assertEqual(request.read(), b"name=value")
362
363 def test_value_after_read(self):
364 """

Callers

nothing calls this directly

Calls 3

FakePayloadClass · 0.90
WSGIRequestClass · 0.90
readMethod · 0.45

Tested by

no test coverage detected