public class MockHttpResponse extends HttpResponse
| Constructor and Description |
|---|
MockHttpResponse(HttpRequest request,
int statusCode)
Creates a HTTP response associated with a
request, returns the statusCode, and has an empty
response body. |
MockHttpResponse(HttpRequest request,
int statusCode,
byte[] bodyBytes)
Creates an HTTP response associated with a
request, returns the statusCode, and response body of
bodyBytes. |
MockHttpResponse(HttpRequest request,
int statusCode,
HttpHeaders headers,
byte[] bodyBytes)
Creates an HTTP response associated with a
request, returns the statusCode, contains the
headers, and response body of bodyBytes. |
MockHttpResponse(HttpRequest request,
int statusCode,
HttpHeaders headers,
Object serializable)
Creates an HTTP response associated with a
request, returns the statusCode, contains the given
headers, and response body that is JSON serialized from serializable. |
| Modifier and Type | Method and Description |
|---|---|
MockHttpResponse |
addHeader(String name,
String value)
Adds the header
name and value to the existing set of HTTP headers. |
reactor.core.publisher.Flux<io.netty.buffer.ByteBuf> |
body() |
reactor.core.publisher.Mono<byte[]> |
bodyAsByteArray() |
reactor.core.publisher.Mono<String> |
bodyAsString() |
reactor.core.publisher.Mono<String> |
bodyAsString(Charset charset) |
HttpHeaders |
headers() |
String |
headerValue(String name) |
int |
statusCode() |
buffer, close, request, requestpublic MockHttpResponse(HttpRequest request, int statusCode)
request, returns the statusCode, and has an empty
response body.request - HttpRequest associated with the response.statusCode - Status code of the response.public MockHttpResponse(HttpRequest request, int statusCode, byte[] bodyBytes)
request, returns the statusCode, and response body of
bodyBytes.request - HttpRequest associated with the response.statusCode - Status code of the response.bodyBytes - Contents of the response.public MockHttpResponse(HttpRequest request, int statusCode, HttpHeaders headers, byte[] bodyBytes)
request, returns the statusCode, contains the
headers, and response body of bodyBytes.request - HttpRequest associated with the response.statusCode - Status code of the response.headers - HttpHeaders of the response.bodyBytes - Contents of the response.public MockHttpResponse(HttpRequest request, int statusCode, HttpHeaders headers, Object serializable)
request, returns the statusCode, contains the given
headers, and response body that is JSON serialized from serializable.request - HttpRequest associated with the response.headers - HttpHeaders of the response.statusCode - Status code of the response.serializable - Contents to be serialized into JSON for the response.public int statusCode()
statusCode in class HttpResponsepublic String headerValue(String name)
headerValue in class HttpResponsepublic HttpHeaders headers()
headers in class HttpResponsepublic reactor.core.publisher.Mono<byte[]> bodyAsByteArray()
bodyAsByteArray in class HttpResponsepublic reactor.core.publisher.Flux<io.netty.buffer.ByteBuf> body()
body in class HttpResponsepublic reactor.core.publisher.Mono<String> bodyAsString()
bodyAsString in class HttpResponsepublic reactor.core.publisher.Mono<String> bodyAsString(Charset charset)
bodyAsString in class HttpResponsepublic MockHttpResponse addHeader(String name, String value)
name and value to the existing set of HTTP headers.name - The header to addvalue - The header value.Copyright © 2019 Microsoft Corporation. All rights reserved.