Package | Description |
---|---|
okhttp3.internal.duplex | |
okhttp3.mockwebserver |
Modifier and Type | Method and Description |
---|---|
abstract void |
MwsDuplexAccess.setBody(MockResponse mockResponse,
DuplexResponseBody duplexResponseBody) |
Modifier and Type | Field and Description |
---|---|
protected BlockingQueue<MockResponse> |
QueueDispatcher.responseQueue |
Modifier and Type | Method and Description |
---|---|
MockResponse |
MockResponse.addHeader(String header)
Adds
header as an HTTP header. |
MockResponse |
MockResponse.addHeader(String name,
Object value)
Adds a new header with the name and value.
|
MockResponse |
MockResponse.addHeaderLenient(String name,
Object value)
Adds a new header with the name and value.
|
MockResponse |
MockResponse.clearHeaders()
Removes all HTTP headers including any "Content-Length" and "Transfer-encoding" headers that
were added by default.
|
MockResponse |
MockResponse.clone() |
abstract MockResponse |
Dispatcher.dispatch(RecordedRequest request)
Returns a response to satisfy
request . |
MockResponse |
QueueDispatcher.dispatch(RecordedRequest request) |
MockResponse |
Dispatcher.peek()
Returns an early guess of the next response, used for policy on how an incoming request should
be received.
|
MockResponse |
QueueDispatcher.peek() |
MockResponse |
MockResponse.removeHeader(String name)
Removes all headers named
name . |
MockResponse |
PushPromise.response() |
MockResponse |
MockResponse.setBody(okio.Buffer body) |
MockResponse |
MockResponse.setBody(String body)
Sets the response body to the UTF-8 encoded bytes of
body . |
MockResponse |
MockResponse.setBodyDelay(long delay,
TimeUnit unit)
Set the delayed time of the response body to
delay . |
MockResponse |
MockResponse.setChunkedBody(okio.Buffer body,
int maxChunkSize)
Sets the response body to
body , chunked every maxChunkSize bytes. |
MockResponse |
MockResponse.setChunkedBody(String body,
int maxChunkSize)
Sets the response body to the UTF-8 encoded bytes of
body , chunked every maxChunkSize bytes. |
MockResponse |
MockResponse.setHeader(String name,
Object value)
Removes all headers named
name , then adds a new header with the name and value. |
MockResponse |
MockResponse.setHeaders(Headers headers)
Replaces all headers with those specified.
|
MockResponse |
MockResponse.setHeadersDelay(long delay,
TimeUnit unit) |
MockResponse |
MockResponse.setHttp2ErrorCode(int http2ErrorCode)
Sets the HTTP/2 error code to be
returned when resetting the stream.
|
MockResponse |
MockResponse.setResponseCode(int code) |
MockResponse |
MockResponse.setSocketPolicy(SocketPolicy socketPolicy) |
MockResponse |
MockResponse.setStatus(String status) |
MockResponse |
MockResponse.setTrailers(Headers trailers)
Replaces all trailers with those specified.
|
MockResponse |
MockResponse.throttleBody(long bytesPerPeriod,
long period,
TimeUnit unit)
Throttles the request reader and response writer to sleep for the given period after each
series of
bytesPerPeriod bytes are transferred. |
MockResponse |
MockResponse.withPush(PushPromise promise)
When
protocols include Protocol.HTTP_2, this attaches a pushed stream to this response. |
MockResponse |
MockResponse.withSettings(okhttp3.internal.http2.Settings settings)
|
MockResponse |
MockResponse.withWebSocketUpgrade(WebSocketListener listener)
Attempts to perform a web socket upgrade on the connection.
|
Modifier and Type | Method and Description |
---|---|
void |
MockWebServer.enqueue(MockResponse response)
Scripts
response to be returned to a request made in sequence. |
void |
QueueDispatcher.enqueueResponse(MockResponse response) |
void |
QueueDispatcher.setFailFast(MockResponse failFastResponse) |
Constructor and Description |
---|
PushPromise(String method,
String path,
Headers headers,
MockResponse response) |
Copyright © 2019. All rights reserved.