mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Align HttpStatus with RFC9110
This commit updates the `HttpStatus` enum with the latest changes in RFC9110: * deprecate "413 Payload Too Large" in favor of "413 Content Too Large" * deprecate "418 I'm a teapot" as it was meant as a joke and is now marked as unused * Introduce new "421 Misdirected Request" * deprecate "422 Unprocessable Entity" in favor of "422 Unprocessable Content" * deprecate "509 Bandwidth Limit Exceeded" as it's now unassigned * deprecate "510 Not Extended" as it's now marked as "historic" The relevant exceptions, test matchers and more have been updated as a result. Closes gh-32870
This commit is contained in:
+38
-2
@@ -141,7 +141,9 @@ public class StatusResultMatchers {
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.PROCESSING} (102).
|
||||
* @deprecated since 7.0, removed from <a href="https://datatracker.ietf.org/doc/html/rfc4918#section-21.4">WebDAV specification</a>
|
||||
*/
|
||||
@Deprecated(since = "7.0")
|
||||
public ResultMatcher isProcessing() {
|
||||
return matcher(HttpStatus.PROCESSING);
|
||||
}
|
||||
@@ -364,10 +366,20 @@ public class StatusResultMatchers {
|
||||
return matcher(HttpStatus.PRECONDITION_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.CONTENT_TOO_LARGE} (413).
|
||||
* @since 7.0
|
||||
*/
|
||||
public ResultMatcher isContentTooLarge() {
|
||||
return matcher(HttpStatus.CONTENT_TOO_LARGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.PAYLOAD_TOO_LARGE} (413).
|
||||
* @since 4.1
|
||||
* @deprecated since 7.0 in favor of {@link #isContentTooLarge()}
|
||||
*/
|
||||
@Deprecated(since = "7.0")
|
||||
public ResultMatcher isPayloadTooLarge() {
|
||||
return matcher(HttpStatus.PAYLOAD_TOO_LARGE);
|
||||
}
|
||||
@@ -403,14 +415,34 @@ public class StatusResultMatchers {
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.I_AM_A_TEAPOT} (418).
|
||||
* @deprecated since 7.0, this was marked as unused in RFC 9110
|
||||
*/
|
||||
@Deprecated(since = "7.0")
|
||||
public ResultMatcher isIAmATeapot() {
|
||||
return matcher(HttpStatus.valueOf(418));
|
||||
return matcher(HttpStatus.I_AM_A_TEAPOT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.MISDIRECTED_REQUEST} (421).
|
||||
* @since 7.0
|
||||
*/
|
||||
public ResultMatcher isMisdirectedRequest() {
|
||||
return matcher(HttpStatus.MISDIRECTED_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.UNPROCESSABLE_CONTENT} (422).
|
||||
* @since 7.0
|
||||
*/
|
||||
public ResultMatcher isUnprocessableContent() {
|
||||
return matcher(HttpStatus.UNPROCESSABLE_CONTENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.UNPROCESSABLE_ENTITY} (422).
|
||||
* @deprecated since 7.0 in favor of {@link #isUnprocessableContent()}
|
||||
*/
|
||||
@Deprecated(since = "7.0")
|
||||
public ResultMatcher isUnprocessableEntity() {
|
||||
return matcher(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
@@ -538,14 +570,18 @@ public class StatusResultMatchers {
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.BANDWIDTH_LIMIT_EXCEEDED} (509).
|
||||
* @deprecated since 7.0, since this is now unassigned
|
||||
*/
|
||||
@Deprecated(since = "7.0")
|
||||
public ResultMatcher isBandwidthLimitExceeded() {
|
||||
return matcher(HttpStatus.valueOf(509));
|
||||
return matcher(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the response status code is {@code HttpStatus.NOT_EXTENDED} (510).
|
||||
* @deprecated since 7.0, this is now marked as "historic" and not endorsed by a standards body.
|
||||
*/
|
||||
@Deprecated(since = "7.0")
|
||||
public ResultMatcher isNotExtended() {
|
||||
return matcher(HttpStatus.NOT_EXTENDED);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user