Skip to content

Commit

Permalink
Rename "Payload Too Large" to "Content Too Large" (#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
sleberknight authored Jun 3, 2024
1 parent 2d307ad commit 8afa6fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/main/java/org/kiwiproject/net/KiwiHttpResponses.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,16 @@ public static boolean preconditionFailed(int statusCode) {
}

/**
* Check if the given status code is 413 Payload Too Large.
* Check if the given status code is 413 Content Too Large.
* <p>
* According to the Mozilla documentation, this used to be
* known as Payload Too Large, and that terminology is still
* apparently widely used.
*
* @param statusCode the status code to check
* @return true if the status code is 413, otherwise false
*/
public static boolean payloadTooLarge(int statusCode) {
public static boolean contentTooLarge(int statusCode) {
return statusCode == 413;
}

Expand Down Expand Up @@ -583,7 +587,7 @@ public static String reasonPhraseOf(int statusCode) {
case 410 -> "Gone";
case 411 -> "Length Required";
case 412 -> "Precondition Failed";
case 413 -> "Payload Too Large";
case 413 -> "Content Too Large";
case 414 -> "URI Too Long";
case 415 -> "Unsupported Media Type";
case 416 -> "Range Not Satisfiable";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void shouldPassStatusCodeChecks(int statusCode) {
() -> assertThat(KiwiHttpResponses.preconditionFailed(statusCode))
.isEqualTo(statusCode == 412),

() -> assertThat(KiwiHttpResponses.payloadTooLarge(statusCode))
() -> assertThat(KiwiHttpResponses.contentTooLarge(statusCode))
.isEqualTo(statusCode == 413),

() -> assertThat(KiwiHttpResponses.uriTooLong(statusCode))
Expand Down

0 comments on commit 8afa6fb

Please sign in to comment.