Make MockClientHttpResponse uses raw status code
This commit make sure that MockClientHttpResponse does not use HttpStatus, but the raw status code. Closes gh-23599
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.test.web.reactive.server;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -31,7 +30,6 @@ import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.http.HttpCookie;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.client.reactive.ClientHttpConnector;
|
||||
import org.springframework.http.client.reactive.ClientHttpRequest;
|
||||
import org.springframework.http.client.reactive.ClientHttpResponse;
|
||||
@@ -121,8 +119,8 @@ public class HttpHandlerConnector implements ClientHttpConnector {
|
||||
}
|
||||
|
||||
private ClientHttpResponse adaptResponse(MockServerHttpResponse response, Flux<DataBuffer> body) {
|
||||
HttpStatus status = Optional.ofNullable(response.getStatusCode()).orElse(HttpStatus.OK);
|
||||
MockClientHttpResponse clientResponse = new MockClientHttpResponse(status);
|
||||
Integer status = response.getStatusCodeValue();
|
||||
MockClientHttpResponse clientResponse = new MockClientHttpResponse((status != null) ? status : 200);
|
||||
clientResponse.getHeaders().putAll(response.getHeaders());
|
||||
clientResponse.getCookies().putAll(response.getCookies());
|
||||
clientResponse.setBody(body);
|
||||
|
||||
Reference in New Issue
Block a user