diff options
| author | Tim Graham <timograham@gmail.com> | 2019-03-01 13:47:09 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-03-02 09:19:05 -0500 |
| commit | 8ec7ded3706fe66bf307ed339eb852d73f6d10d0 (patch) | |
| tree | b2ad9b885302717a70e3a9fb0d7d751783d4d637 /tests | |
| parent | 2ed2acf872b87d1149da98ceeb96997f23258e83 (diff) | |
Refs #30227 -- Added helpful message for non-ASCII Content-Type in mulitpart request.
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 945d77ff6e..a97b98e8a2 100644 --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -487,6 +487,17 @@ class RequestsTests(SimpleTestCase): with self.assertRaisesMessage(MultiPartParserError, 'Invalid boundary in multipart: None'): request.POST + def test_multipart_non_ascii_content_type(self): + request = WSGIRequest({ + 'REQUEST_METHOD': 'POST', + 'CONTENT_TYPE': 'multipart/form-data; boundary = \xe0', + 'CONTENT_LENGTH': 0, + 'wsgi.input': FakePayload(), + }) + msg = 'Invalid non-ASCII Content-Type in multipart: multipart/form-data; boundary = à' + with self.assertRaisesMessage(MultiPartParserError, msg): + request.POST + def test_POST_connection_error(self): """ If wsgi.input.read() raises an exception while trying to read() the |
