Package com.apollographql.apollo3.mockserver

Types

Link copied to clipboard
class ChunkedResponse(    statusCode: Int = 200,     partsContentType: String = "application/json; charset=utf-8",     headers: Map<String, String> = emptyMap(),     responseDelayMillis: Long = 0,     chunksDelayMillis: Long = 0,     boundary: String = "-")
Link copied to clipboard
class FileDescriptorSink(val fd: Int) : Sink
Link copied to clipboard
class FileDescriptorSource(val fd: Int) : Source
Link copied to clipboard
class MockRequest(    val method: String,     val path: String,     val version: String,     val headers: Map<String, String> = emptyMap(),     val body: ByteString = ByteString.EMPTY)
Link copied to clipboard
class MockResponse @ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v3_3_1) constructor(    val statusCode: Int = 200,     val body: Flow<ByteString> = emptyFlow(),     val headers: Map<String, String> = mapOf("Content-Length" to "0"),     val delayMillis: Long = 0)
Link copied to clipboard
actual class MockServer : MockServerInterface
expect class MockServer : MockServerInterface
actual class MockServer : MockServerInterface
actual class MockServer : MockServerInterface
Link copied to clipboard
interface MockServerHandler
Link copied to clipboard
interface MockServerInterface
Link copied to clipboard
class Socket(    socketFd: Int,     acceptDelayMillis: Long,     mockServerHandler: MockServerHandler)

Functions

Link copied to clipboard
fun Flow<ByteString>.asChunked(): Flow<ByteString>

Turns a Flow into a Transfer-Encoding: chunked compatible one.

Link copied to clipboard
fun createMultipartMixedChunkedResponse(    parts: List<String>,     statusCode: Int = 200,     partsContentType: String = "application/json; charset=utf-8",     headers: Map<String, String> = emptyMap(),     responseDelayMillis: Long = 0,     chunksDelayMillis: Long = 0,     boundary: String = "-"): MockResponse
Link copied to clipboard
fun createMultipartMixedPart(    content: String,     contentType: String = "application/json; charset=utf-8",     boundary: String = "-",     isFirst: Boolean = false,     isLast: Boolean = false): String
Link copied to clipboard
fun MockServer.enqueue(    string: String = "",     delayMs: Long = 0,     statusCode: Int = 200)
Link copied to clipboard
fun MockServer.enqueueMultipart(    parts: List<String>,     statusCode: Int = 200,     partsContentType: String = "application/json; charset=utf-8",     headers: Map<String, String> = emptyMap(),     responseDelayMillis: Long = 0,     chunksDelayMillis: Long = 0,     boundary: String = "-")
Link copied to clipboard
fun parseHeader(line: String): Pair<String, String>
Link copied to clipboard
fun parseRequestLine(line: String): Triple<String, String, String>
Link copied to clipboard
fun BufferedSource.readChunked(buffer: Buffer)

Read a source encoded in the "Transfer-Encoding: chunked" encoding. This format is a sequence of:

Link copied to clipboard
suspend fun writeResponse(    sink: BufferedSink,     mockResponse: MockResponse,     version: String)