diff options
| author | Tim Graham <timograham@gmail.com> | 2019-03-01 12:53:18 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-03-02 09:19:05 -0500 |
| commit | 2ed2acf872b87d1149da98ceeb96997f23258e83 (patch) | |
| tree | 8c45183fc6666c0406bd7288f8c66ba64a6a36f7 /tests | |
| parent | 8a2ec55b180d3fddf4578de2e6759127c8250ce7 (diff) | |
Fixed #30227 -- Fixed crash on request without boundary in Content-Type.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/requests/tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/requests/tests.py b/tests/requests/tests.py index 9391ca2a08..945d77ff6e 100644 --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -5,6 +5,7 @@ from urllib.parse import urlencode from django.core.exceptions import DisallowedHost from django.core.handlers.wsgi import LimitedStream, WSGIRequest from django.http import HttpRequest, RawPostDataException, UnreadablePostError +from django.http.multipartparser import MultiPartParserError from django.http.request import HttpHeaders, split_domain_port from django.test import RequestFactory, SimpleTestCase, override_settings from django.test.client import FakePayload @@ -476,6 +477,16 @@ class RequestsTests(SimpleTestCase): }) self.assertFalse(request.POST._mutable) + def test_multipart_without_boundary(self): + request = WSGIRequest({ + 'REQUEST_METHOD': 'POST', + 'CONTENT_TYPE': 'multipart/form-data;', + 'CONTENT_LENGTH': 0, + 'wsgi.input': FakePayload(), + }) + with self.assertRaisesMessage(MultiPartParserError, 'Invalid boundary in multipart: None'): + request.POST + def test_POST_connection_error(self): """ If wsgi.input.read() raises an exception while trying to read() the |
