public class MockHttpResponse
extends com.azure.core.http.HttpResponse
| Constructor and Description |
|---|
MockHttpResponse(com.azure.core.http.HttpRequest request,
int statusCode)
Creates a HTTP response associated with a
request, returns the statusCode, and has an empty
response body. |
MockHttpResponse(com.azure.core.http.HttpRequest request,
int statusCode,
byte[] bodyBytes)
Creates an HTTP response associated with a
request, returns the statusCode, and response body of
bodyBytes. |
MockHttpResponse(com.azure.core.http.HttpRequest request,
int statusCode,
com.azure.core.http.HttpHeaders headers)
Creates an HTTP response associated with a
request, returns the statusCode, and http headers. |
MockHttpResponse(com.azure.core.http.HttpRequest request,
int statusCode,
com.azure.core.http.HttpHeaders headers,
byte[] bodyBytes)
Creates an HTTP response associated with a
request, returns the statusCode, contains the
headers, and response body of bodyBytes. |
MockHttpResponse(com.azure.core.http.HttpRequest request,
int statusCode,
com.azure.core.http.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. |
MockHttpResponse(com.azure.core.http.HttpRequest request,
int statusCode,
Object serializable)
Creates an HTTP response associated with a
request, returns the statusCode, 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. |
Flux<ByteBuffer> |
getBody() |
Mono<byte[]> |
getBodyAsByteArray() |
Mono<String> |
getBodyAsString() |
Mono<String> |
getBodyAsString(Charset charset) |
com.azure.core.http.HttpHeaders |
getHeaders() |
String |
getHeaderValue(String name) |
int |
getStatusCode() |
public MockHttpResponse(com.azure.core.http.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(com.azure.core.http.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(com.azure.core.http.HttpRequest request,
int statusCode,
com.azure.core.http.HttpHeaders headers)
request, returns the statusCode, and http headers.request - HttpRequest associated with the response.statusCode - Status code of the response.headers - Headers of the response.public MockHttpResponse(com.azure.core.http.HttpRequest request,
int statusCode,
com.azure.core.http.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(com.azure.core.http.HttpRequest request,
int statusCode,
com.azure.core.http.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 MockHttpResponse(com.azure.core.http.HttpRequest request,
int statusCode,
Object serializable)
request, returns the statusCode, and response body
that is JSON serialized from serializable.request - HttpRequest associated with the response.statusCode - Status code of the response.serializable - Contents to be serialized into JSON for the response.public int getStatusCode()
getStatusCode in class com.azure.core.http.HttpResponsepublic String getHeaderValue(String name)
getHeaderValue in class com.azure.core.http.HttpResponsepublic com.azure.core.http.HttpHeaders getHeaders()
getHeaders in class com.azure.core.http.HttpResponsepublic Mono<byte[]> getBodyAsByteArray()
getBodyAsByteArray in class com.azure.core.http.HttpResponsepublic Flux<ByteBuffer> getBody()
getBody in class com.azure.core.http.HttpResponsepublic Mono<String> getBodyAsString()
getBodyAsString in class com.azure.core.http.HttpResponsepublic Mono<String> getBodyAsString(Charset charset)
getBodyAsString in class com.azure.core.http.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 © 2020 Microsoft Corporation. All rights reserved.