Merge branch '5.3.x'

# Conflicts:
#	spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java
This commit is contained in:
Sam Brannen
2022-10-08 16:03:52 +02:00
2 changed files with 21 additions and 10 deletions

View File

@@ -50,6 +50,7 @@ import org.springframework.util.MultiValueMap;
* respectively.
*
* @author Rossen Stoyanchev
* @author Sam Brannen
* @since 5.0
* @see EntityExchangeResult
* @see FluxExchangeResult
@@ -168,7 +169,6 @@ public class ExchangeResult {
return this.requestBody.block(this.timeout);
}
/**
* Return the HTTP status code as an {@link HttpStatusCode} value.
*/
@@ -249,20 +249,19 @@ public class ExchangeResult {
"\n" +
formatBody(getRequestHeaders().getContentType(), this.requestBody) + "\n" +
"\n" +
"< " + getStatus() + " " + getReasonPhrase(getStatus()) + "\n" +
"< " + formatStatus(getStatus()) + "\n" +
"< " + formatHeaders(getResponseHeaders(), "\n< ") + "\n" +
"\n" +
formatBody(getResponseHeaders().getContentType(), this.responseBody) +"\n" +
formatMockServerResult();
}
private static String getReasonPhrase(HttpStatusCode statusCode) {
private String formatStatus(HttpStatusCode statusCode) {
String result = statusCode.toString();
if (statusCode instanceof HttpStatus status) {
return status.getReasonPhrase();
}
else {
return "";
result += " " + status.getReasonPhrase();
}
return result;
}
private String formatHeaders(HttpHeaders headers, String delimiter) {