Accept POST request with empty body

This commit is contained in:
Miguel Grinberg
2022-07-30 14:57:36 +01:00
parent 120abe45ec
commit bf3aff6c35
2 changed files with 11 additions and 2 deletions

View File

@@ -73,6 +73,14 @@ class TestRequest(unittest.TestCase):
{'foo': 'bar', 'abc': 'def', 'x': '/%%'}))
self.assertTrue(req.form is form)
fd = get_request_fd('GET', '/foo', headers={
'Content-Type': 'application/x-www-form-urlencoded'},
body='')
req = Request.create('app', fd, 'addr')
form = req.form
self.assertEqual(form, MultiDict({}))
self.assertTrue(req.form is form)
fd = get_request_fd('GET', '/foo', headers={
'Content-Type': 'application/json'},
body='foo=bar&abc=def&x=%2f%%')