|
|
|
@ -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"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with 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; |
|
|
|
package org.springframework.test.web.reactive.server; |
|
|
|
|
|
|
|
|
|
|
|
import java.net.URI; |
|
|
|
import java.net.URI; |
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.function.Function; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
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.HttpCookie; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpMethod; |
|
|
|
import org.springframework.http.HttpMethod; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
|
|
|
|
import org.springframework.http.client.reactive.ClientHttpConnector; |
|
|
|
import org.springframework.http.client.reactive.ClientHttpConnector; |
|
|
|
import org.springframework.http.client.reactive.ClientHttpRequest; |
|
|
|
import org.springframework.http.client.reactive.ClientHttpRequest; |
|
|
|
import org.springframework.http.client.reactive.ClientHttpResponse; |
|
|
|
import org.springframework.http.client.reactive.ClientHttpResponse; |
|
|
|
@ -121,8 +119,8 @@ public class HttpHandlerConnector implements ClientHttpConnector { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ClientHttpResponse adaptResponse(MockServerHttpResponse response, Flux<DataBuffer> body) { |
|
|
|
private ClientHttpResponse adaptResponse(MockServerHttpResponse response, Flux<DataBuffer> body) { |
|
|
|
HttpStatus status = Optional.ofNullable(response.getStatusCode()).orElse(HttpStatus.OK); |
|
|
|
Integer status = response.getStatusCodeValue(); |
|
|
|
MockClientHttpResponse clientResponse = new MockClientHttpResponse(status); |
|
|
|
MockClientHttpResponse clientResponse = new MockClientHttpResponse((status != null) ? status : 200); |
|
|
|
clientResponse.getHeaders().putAll(response.getHeaders()); |
|
|
|
clientResponse.getHeaders().putAll(response.getHeaders()); |
|
|
|
clientResponse.getCookies().putAll(response.getCookies()); |
|
|
|
clientResponse.getCookies().putAll(response.getCookies()); |
|
|
|
clientResponse.setBody(body); |
|
|
|
clientResponse.setBody(body); |
|
|
|
|