提交 b159ef60 编写于 作者: A Arjen Poutsma

Make MockClientHttpResponse uses raw status code

This commit make sure that MockClientHttpResponse does not use
HttpStatus, but the raw status code.

Closes gh-23599
上级 96101005
/*
* 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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册