Repository: falconry/falcon
Pull request #1357 (2018-09-29 21:11:10)

refactor(falcon.errors): Rename HTTPRequestEntityTooLarge to HTTPPayloadTooLarge
#1347 

codecov[bot]: # [Codecov](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=h1) Report
> Merging [#1357](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=desc) into [master](https://codecov.io/gh/falconry/falcon/commit/90d0cd6c69b527a666912e0d0752cf303c134a0c?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/falconry/falcon/pull/1357/graphs/tree.svg?width=650&token=zOtkfNQ3h6&height=150&src=pr)](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=tree)

```diff
@@          Coverage Diff           @@
##           master   #1357   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files          38      38           
  Lines        2539    2539           
  Branches      389     389           
======================================
  Hits         2539    2539
```


| [Impacted Files](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [falcon/errors.py](https://codecov.io/gh/falconry/falcon/pull/1357/diff?src=pr&el=tree#diff-ZmFsY29uL2Vycm9ycy5weQ==) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=footer). Last update [90d0cd6...3166e21](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

codecov[bot]: # [Codecov](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=h1) Report
> Merging [#1357](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=desc) into [master](https://codecov.io/gh/falconry/falcon/commit/3024935e2f4183092b9940fcf081a61389a43b44?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/falconry/falcon/pull/1357/graphs/tree.svg?width=650&token=zOtkfNQ3h6&height=150&src=pr)](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=tree)

```diff
@@          Coverage Diff           @@
##           master   #1357   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files          38      38           
  Lines        2539    2539           
  Branches      389     389           
======================================
  Hits         2539    2539
```


| [Impacted Files](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [falcon/errors.py](https://codecov.io/gh/falconry/falcon/pull/1357/diff?src=pr&el=tree#diff-ZmFsY29uL2Vycm9ycy5weQ==) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=footer). Last update [3024935...2444e98](https://codecov.io/gh/falconry/falcon/pull/1357?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/README.rst b/README.rst
index 9b22337..7657cd0 100644
--- a/README.rst
+++ b/README.rst
@@ -556,7 +556,7 @@ bodies.
                 msg = ('The size of the request is too large. The body must not '
                        'exceed ' + str(limit) + ' bytes in length.')
 
-                raise falcon.HTTPRequestEntityTooLarge(
+                raise falcon.HTTPPayloadTooLarge(
                     'Request body is too large', msg)
 
         return hook
diff --git a/docs/api/errors.rst b/docs/api/errors.rst
index 24d3ecc..ad9ad82 100644
--- a/docs/api/errors.rst
+++ b/docs/api/errors.rst
@@ -90,7 +90,7 @@ Predefined Errors
         HTTPInvalidParam, HTTPMissingParam,
         HTTPUnauthorized, HTTPForbidden, HTTPNotFound, HTTPMethodNotAllowed,
         HTTPNotAcceptable, HTTPConflict, HTTPGone, HTTPLengthRequired,
-        HTTPPreconditionFailed, HTTPRequestEntityTooLarge, HTTPUriTooLong,
+        HTTPPreconditionFailed, HTTPPayloadTooLarge, HTTPUriTooLong,
         HTTPUnsupportedMediaType, HTTPRangeNotSatisfiable,
         HTTPUnprocessableEntity, HTTPLocked, HTTPFailedDependency,
         HTTPPreconditionRequired, HTTPTooManyRequests,
diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst
index f776b36..4f95b67 100644
--- a/docs/user/quickstart.rst
+++ b/docs/user/quickstart.rst
@@ -217,7 +217,7 @@ parameters, handling errors, and working with request and response bodies.
                 msg = ('The size of the request is too large. The body must not '
                        'exceed ' + str(limit) + ' bytes in length.')
 
-                raise falcon.HTTPRequestEntityTooLarge(
+                raise falcon.HTTPPayloadTooLarge(
                     'Request body is too large', msg)
 
         return hook
diff --git a/falcon/errors.py b/falcon/errors.py
index e6e7b08..a6528d1 100644
--- a/falcon/errors.py
+++ b/falcon/errors.py
@@ -596,8 +596,8 @@ class HTTPPreconditionFailed(HTTPError):
                                                      **kwargs)
 
 
-class HTTPRequestEntityTooLarge(HTTPError):
-    """413 Request Entity Too Large.
+class HTTPPayloadTooLarge(HTTPError):
+    """413 Payload Too Large.
 
     The server is refusing to process a request because the request
     payload is larger than the server is willing or able to process.
@@ -612,7 +612,7 @@ class HTTPRequestEntityTooLarge(HTTPError):
     (See also: RFC 7231, Section 6.5.11)
 
     Keyword Args:
-        title (str): Error title (default '413 Request Entity Too Large').
+        title (str): Error title (default '413 Payload Too Large').
 
         description (str): Human-friendly description of the error, along with
             a helpful suggestion or two.
@@ -656,11 +656,11 @@ class HTTPRequestEntityTooLarge(HTTPError):
         elif retry_after is not None:
             headers['Retry-After'] = str(retry_after)
 
-        super(HTTPRequestEntityTooLarge, self).__init__(status.HTTP_413,
-                                                        title,
-                                                        description,
-                                                        headers,
-                                                        **kwargs)
+        super(HTTPPayloadTooLarge, self).__init__(status.HTTP_413,
+                                                  title,
+                                                  description,
+                                                  headers,
+                                                  **kwargs)
 
 
 class HTTPUriTooLong(HTTPError):


Test patch:
diff --git a/tests/test_error.py b/tests/test_error.py
index 3c6ef4f..3e2b4c8 100644
--- a/tests/test_error.py
+++ b/tests/test_error.py
@@ -10,7 +10,7 @@ import falcon.status_codes as status
     (falcon.HTTPConflict, status.HTTP_409),
     (falcon.HTTPLengthRequired, status.HTTP_411),
     (falcon.HTTPPreconditionFailed, status.HTTP_412),
-    (falcon.HTTPRequestEntityTooLarge, status.HTTP_413),
+    (falcon.HTTPPayloadTooLarge, status.HTTP_413),
     (falcon.HTTPUriTooLong, status.HTTP_414),
     (falcon.HTTPUnprocessableEntity, status.HTTP_422),
     (falcon.HTTPLocked, status.HTTP_423),
@@ -79,7 +79,7 @@ def test_with_title_desc_and_headers(err):
 @pytest.mark.parametrize('err', [
     falcon.HTTPServiceUnavailable,
     falcon.HTTPTooManyRequests,
-    falcon.HTTPRequestEntityTooLarge,
+    falcon.HTTPPayloadTooLarge,
 ])
 def test_with_retry_after(err):
     with pytest.raises(err) as e:
@@ -91,7 +91,7 @@ def test_with_retry_after(err):
 @pytest.mark.parametrize('err', [
     falcon.HTTPServiceUnavailable,
     falcon.HTTPTooManyRequests,
-    falcon.HTTPRequestEntityTooLarge,
+    falcon.HTTPPayloadTooLarge,
 ])
 def test_with_retry_after_and_headers(err):
     with pytest.raises(err) as e:
diff --git a/tests/test_example.py b/tests/test_example.py
index d9b6c8e..21b914a 100644
--- a/tests/test_example.py
+++ b/tests/test_example.py
@@ -136,7 +136,7 @@ def max_body(limit):
             msg = ('The size of the request is too large. The body must not '
                    'exceed ' + str(limit) + ' bytes in length.')
 
-            raise falcon.HTTPRequestEntityTooLarge(
+            raise falcon.HTTPPayloadTooLarge(
                 'Request body is too large', msg)
 
     return hook
diff --git a/tests/test_httperror.py b/tests/test_httperror.py
index d6b0519..54ed8e6 100644
--- a/tests/test_httperror.py
+++ b/tests/test_httperror.py
@@ -159,8 +159,8 @@ class LengthRequiredResource:
 class RequestEntityTooLongResource:
 
     def on_get(self, req, resp):
-        raise falcon.HTTPRequestEntityTooLarge('Request Rejected',
-                                               'Request Body Too Large')
+        raise falcon.HTTPPayloadTooLarge('Request Rejected',
+                                         'Request Body Too Large')
 
 
 class TemporaryRequestEntityTooLongResource:
@@ -169,9 +169,9 @@ class TemporaryRequestEntityTooLongResource:
         self.retry_after = retry_after
 
     def on_get(self, req, resp):
-        raise falcon.HTTPRequestEntityTooLarge('Request Rejected',
-                                               'Request Body Too Large',
-                                               retry_after=self.retry_after)
+        raise falcon.HTTPPayloadTooLarge('Request Rejected',
+                                         'Request Body Too Large',
+                                         retry_after=self.retry_after)
 
 
 class UriTooLongResource: