Add rawStatusCode() to ServerResponse in both WebFlux and Servlet

Closes gh-22872
This commit is contained in:
Arjen Poutsma
2019-07-19 15:53:15 +02:00
parent 56c2987273
commit 7b73418418
9 changed files with 47 additions and 2 deletions

View File

@@ -264,6 +264,11 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder {
return HttpStatus.valueOf(this.statusCode);
}
@Override
public int rawStatusCode() {
return this.statusCode;
}
@Override
public final HttpHeaders headers() {
return this.headers;

View File

@@ -57,9 +57,20 @@ public interface ServerResponse {
/**
* Return the status code of this response.
* @return the status as an HttpStatus enum value
* @throws IllegalArgumentException in case of an unknown HTTP status code
* @see HttpStatus#valueOf(int)
*/
HttpStatus statusCode();
/**
* Return the (potentially non-standard) status code of this response.
* @return the status as an integer
* @see #statusCode()
* @see HttpStatus#valueOf(int)
*/
int rawStatusCode();
/**
* Return the headers of this response.
*/