|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
17 | 17 | package org.springframework.test.web.reactive.server;
|
18 | 18 |
|
19 | 19 | import java.net.URI;
|
20 |
| -import java.util.Optional; |
21 | 20 | import java.util.function.Function;
|
22 | 21 |
|
23 | 22 | import org.apache.commons.logging.Log;
|
|
31 | 30 | import org.springframework.http.HttpCookie;
|
32 | 31 | import org.springframework.http.HttpHeaders;
|
33 | 32 | import org.springframework.http.HttpMethod;
|
34 |
| -import org.springframework.http.HttpStatus; |
35 | 33 | import org.springframework.http.client.reactive.ClientHttpConnector;
|
36 | 34 | import org.springframework.http.client.reactive.ClientHttpRequest;
|
37 | 35 | import org.springframework.http.client.reactive.ClientHttpResponse;
|
@@ -121,8 +119,8 @@ private ServerHttpResponse prepareResponse(ServerHttpResponse response, ServerHt
|
121 | 119 | }
|
122 | 120 |
|
123 | 121 | private ClientHttpResponse adaptResponse(MockServerHttpResponse response, Flux<DataBuffer> body) {
|
124 |
| - HttpStatus status = Optional.ofNullable(response.getStatusCode()).orElse(HttpStatus.OK); |
125 |
| - MockClientHttpResponse clientResponse = new MockClientHttpResponse(status); |
| 122 | + Integer status = response.getStatusCodeValue(); |
| 123 | + MockClientHttpResponse clientResponse = new MockClientHttpResponse((status != null) ? status : 200); |
126 | 124 | clientResponse.getHeaders().putAll(response.getHeaders());
|
127 | 125 | clientResponse.getCookies().putAll(response.getCookies());
|
128 | 126 | clientResponse.setBody(body);
|
|
0 commit comments