Browse Source

Merge branch '5.1.x'

pull/23619/head
Arjen Poutsma 5 years ago
parent
commit
13ba7ef701
  1. 8
      spring-test/src/main/java/org/springframework/test/web/reactive/server/HttpHandlerConnector.java

8
spring-test/src/main/java/org/springframework/test/web/reactive/server/HttpHandlerConnector.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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 { @@ -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);

Loading…
Cancel
Save