类 MockClientHttpResponse
- java.lang.Object
- org.springframework.mock.http.client.reactive.MockClientHttpResponse
public class MockClientHttpResponse extends Object implements ClientHttpResponse
Mock implementation ofClientHttpResponse
.- 从以下版本开始:
- 5.0
- 作者:
- Brian Clozel, Rossen Stoyanchev
构造器概要
构造器 构造器 说明 MockClientHttpResponse(int status)
MockClientHttpResponse(HttpStatus status)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 reactor.core.publisher.Flux<DataBuffer>
getBody()
Return the body of the message as aPublisher
.reactor.core.publisher.Mono<String>
getBodyAsString()
Return the response body aggregated and converted to a String using the charset of the Content-Type response or otherwise as "UTF-8".MultiValueMap<String,ResponseCookie>
getCookies()
Return a read-only map of response cookies received from the server.HttpHeaders
getHeaders()
Return the headers of this message.int
getRawStatusCode()
Return the HTTP status code (potentially non-standard and not resolvable through theHttpStatus
enum) as an integer.HttpStatus
getStatusCode()
Return the HTTP status code as anHttpStatus
enum value.void
setBody(String body)
void
setBody(String body, Charset charset)
void
setBody(org.reactivestreams.Publisher<DataBuffer> body)
String
toString()
构造器详细资料
MockClientHttpResponse
public MockClientHttpResponse(HttpStatus status)
MockClientHttpResponse
public MockClientHttpResponse(int status)
方法详细资料
getStatusCode
public HttpStatus getStatusCode()
从接口复制的说明:ClientHttpResponse
Return the HTTP status code as anHttpStatus
enum value.- 指定者:
getStatusCode
在接口中ClientHttpResponse
- 返回:
- the HTTP status as an HttpStatus enum value (never
null
) - 另请参阅:
HttpStatus.valueOf(int)
getRawStatusCode
public int getRawStatusCode()
从接口复制的说明:ClientHttpResponse
Return the HTTP status code (potentially non-standard and not resolvable through theHttpStatus
enum) as an integer.- 指定者:
getRawStatusCode
在接口中ClientHttpResponse
- 返回:
- the HTTP status as an integer value
- 另请参阅:
ClientHttpResponse.getStatusCode()
,HttpStatus.resolve(int)
getHeaders
public HttpHeaders getHeaders()
从接口复制的说明:HttpMessage
Return the headers of this message.- 指定者:
getHeaders
在接口中HttpMessage
- 返回:
- a corresponding HttpHeaders object (never
null
)
getCookies
public MultiValueMap<String,ResponseCookie> getCookies()
从接口复制的说明:ClientHttpResponse
Return a read-only map of response cookies received from the server.- 指定者:
getCookies
在接口中ClientHttpResponse
setBody
public void setBody(org.reactivestreams.Publisher<DataBuffer> body)
getBody
public reactor.core.publisher.Flux<DataBuffer> getBody()
从接口复制的说明:ReactiveHttpInputMessage
Return the body of the message as aPublisher
.- 指定者:
getBody
在接口中ReactiveHttpInputMessage
- 返回:
- the body content publisher
getBodyAsString
public reactor.core.publisher.Mono<String> getBodyAsString()
Return the response body aggregated and converted to a String using the charset of the Content-Type response or otherwise as "UTF-8".