| Package | Description |
|---|---|
| com.squareup.okhttp.mockwebserver |
| 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.clearHeaders()
Removes all HTTP headers including any "Content-Length" and
"Transfer-encoding" headers that were added by default.
|
MockResponse |
MockResponse.clone() |
MockResponse |
QueueDispatcher.dispatch(RecordedRequest request) |
abstract MockResponse |
Dispatcher.dispatch(RecordedRequest request)
Returns a response to satisfy
request. |
MockResponse |
PushPromise.getResponse() |
MockResponse |
MockResponse.removeHeader(String name)
Removes all headers named
name. |
MockResponse |
MockResponse.setBody(byte[] body) |
MockResponse |
MockResponse.setBody(InputStream bodyStream,
long bodyLength) |
MockResponse |
MockResponse.setBody(String body)
Sets the response body to the UTF-8 encoded bytes of
body. |
MockResponse |
MockResponse.setBodyDelayTimeMs(int delay)
Set the delayed time of the response body to
delay. |
MockResponse |
MockResponse.setChunkedBody(byte[] 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.setResponseCode(int code) |
MockResponse |
MockResponse.setSocketPolicy(SocketPolicy socketPolicy) |
MockResponse |
MockResponse.setStatus(String status) |
MockResponse |
MockResponse.throttleBody(int bytesPerPeriod,
long period,
TimeUnit unit)
Throttles the response body writer to sleep for the given period after each
series of
bytesPerPeriod bytes are written. |
MockResponse |
MockResponse.withPush(PushPromise promise)
When
protocols
include a SPDY variant, this attaches a pushed stream to this response. |
| 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,
List<String> headers,
MockResponse response) |
Copyright © 2014. All Rights Reserved.