More specific error messages on Payload Too Large.
This commit is contained in:
parent
50cca39185
commit
e73f26b0a3
|
@ -116,7 +116,7 @@ class Http:
|
|||
break
|
||||
await self._receive_more()
|
||||
if pos >= self.request_max_size:
|
||||
raise PayloadTooLarge("Payload Too Large")
|
||||
raise PayloadTooLarge("Request header too large")
|
||||
# Parse header content
|
||||
try:
|
||||
reqline, *raw_headers = buf[:pos].decode().split("\r\n")
|
||||
|
@ -347,7 +347,7 @@ class Http:
|
|||
# Request size limit
|
||||
if self.request_bytes > self.request_max_size:
|
||||
self.keep_alive = False
|
||||
raise PayloadTooLarge("Payload Too Large")
|
||||
raise PayloadTooLarge("Request body too large")
|
||||
# End of request body?
|
||||
if not self.request_bytes_left:
|
||||
self.request_body = None
|
||||
|
|
|
@ -27,7 +27,7 @@ def test_payload_too_large_at_data_received_default(app):
|
|||
|
||||
response = app.test_client.get("/1", gather_request=False)
|
||||
assert response.status == 413
|
||||
assert "Payload Too Large" in response.text
|
||||
assert "Request header" in response.text
|
||||
|
||||
|
||||
def test_payload_too_large_at_on_header_default(app):
|
||||
|
@ -40,4 +40,4 @@ def test_payload_too_large_at_on_header_default(app):
|
|||
data = "a" * 1000
|
||||
response = app.test_client.post("/1", gather_request=False, data=data)
|
||||
assert response.status == 413
|
||||
assert "Payload Too Large" in response.text
|
||||
assert "Request body" in response.text
|
||||
|
|
Loading…
Reference in New Issue
Block a user