Construction of POST or body is not allowed after reading from request.
(self)
| 361 | self.assertEqual(request.read(), b"name=value") |
| 362 | |
| 363 | def test_value_after_read(self): |
| 364 | """ |
| 365 | Construction of POST or body is not allowed after reading |
| 366 | from request. |
| 367 | """ |
| 368 | payload = FakePayload("name=value") |
| 369 | request = WSGIRequest( |
| 370 | { |
| 371 | "REQUEST_METHOD": "POST", |
| 372 | "CONTENT_TYPE": "application/x-www-form-urlencoded", |
| 373 | "CONTENT_LENGTH": len(payload), |
| 374 | "wsgi.input": payload, |
| 375 | } |
| 376 | ) |
| 377 | self.assertEqual(request.read(2), b"na") |
| 378 | with self.assertRaises(RawPostDataException): |
| 379 | request.body |
| 380 | self.assertEqual(request.POST, {}) |
| 381 | |
| 382 | def test_non_ascii_POST(self): |
| 383 | payload = FakePayload(urlencode({"key": "España"})) |
nothing calls this directly
no test coverage detected