Skip to content

//mockwebserver/okhttp3.mockwebserver/MockResponse

MockResponse

[jvm]\ class MockResponse : Cloneable

Constructors

MockResponse [jvm]
fun MockResponse()

Types

Name Summary
Companion [jvm]
object Companion

Functions

Name Summary
addHeader [jvm]
fun addHeader(header: String): MockResponse
fun addHeader(name: String, value: Any): MockResponse
addHeaderLenient [jvm]
fun addHeaderLenient(name: String, value: Any): MockResponse
clearHeaders [jvm]
fun clearHeaders(): MockResponse
clone [jvm]
open override fun clone(): MockResponse
getBody [jvm]
fun getBody(): Buffer?
getBodyDelay [jvm]
fun getBodyDelay(unit: TimeUnit): Long
getHeadersDelay [jvm]
fun getHeadersDelay(unit: TimeUnit): Long
getThrottlePeriod [jvm]
fun getThrottlePeriod(unit: TimeUnit): Long
removeHeader [jvm]
fun removeHeader(name: String): MockResponse
setBody [jvm]
fun setBody(body: String): MockResponse
fun setBody(body: Buffer): MockResponse
setBodyDelay [jvm]
fun setBodyDelay(delay: Long, unit: TimeUnit): MockResponse
setChunkedBody [jvm]
fun setChunkedBody(body: String, maxChunkSize: Int): MockResponse
fun setChunkedBody(body: Buffer, maxChunkSize: Int): MockResponse
setHeader [jvm]
fun setHeader(name: String, value: Any): MockResponse
setHeaders [jvm]
fun setHeaders(headers: Headers): MockResponse
setHeadersDelay [jvm]
fun setHeadersDelay(delay: Long, unit: TimeUnit): MockResponse
setHttp2ErrorCode [jvm]
fun setHttp2ErrorCode(http2ErrorCode: Int): MockResponse
setResponseCode [jvm]
fun setResponseCode(code: Int): MockResponse
setSocketPolicy [jvm]
fun setSocketPolicy(socketPolicy: SocketPolicy): MockResponse
setStatus [jvm]
fun setStatus(status: String): MockResponse
setTrailers [jvm]
fun setTrailers(trailers: Headers): MockResponse
throttleBody [jvm]
fun throttleBody(bytesPerPeriod: Long, period: Long, unit: TimeUnit): MockResponse
toString [jvm]
open override fun toString(): String
withPush [jvm]
fun withPush(promise: PushPromise): MockResponse
withSettings [jvm]
fun withSettings(settings: Settings): MockResponse
withWebSocketUpgrade [jvm]
fun withWebSocketUpgrade(listener: WebSocketListener): MockResponse

Properties

Name Summary
headers [jvm]
@set:JvmName(name = "headers")
var headers: Headers
http2ErrorCode [jvm]
@set:JvmName(name = "http2ErrorCode")
var http2ErrorCode: Int
pushPromises [jvm]
val pushPromises: List<PushPromise>
settings [jvm]
var settings: Settings
socketPolicy [jvm]
@set:JvmName(name = "socketPolicy")
var socketPolicy: SocketPolicy
status [jvm]
@set:JvmName(name = "status")
var status: String
throttleBytesPerPeriod [jvm]
var throttleBytesPerPeriod: Long
trailers [jvm]
@set:JvmName(name = "trailers")
var trailers: Headers
webSocketListener [jvm]
var webSocketListener: WebSocketListener? = null