Queue

class Queue(val config: MockEngineConfig = MockEngineConfig().apply { // Every time a handler is called, it gets disposed. So make sure enough handlers are registered for // requests you intend to make! reuseHandlers = false }) : MockEngine(source)

Create a MockEngine with an empty MockEngineConfig - meaning no request handlers are registered by default. This means that you need to separately call enqueue to add one or more handlers before making any requests.

Most useful if you want to create an io.ktor.client.HttpClient instance before your test begins, and need to specify behaviour on a per-test basis.

Report a problem

Constructors

Link copied to clipboard
constructor(config: MockEngineConfig = MockEngineConfig().apply { // Every time a handler is called, it gets disposed. So make sure enough handlers are registered for // requests you intend to make! reuseHandlers = false })

Properties

Link copied to clipboard
open override val config: MockEngineConfig
Link copied to clipboard
Link copied to clipboard
open override val dispatcher: CoroutineDispatcher
Link copied to clipboard

History of executed requests.

Link copied to clipboard

History of sent responses.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard

Appends a new MockRequestHandler, to be called/removed after any previous handlers have been consumed.

Link copied to clipboard
open suspend override fun execute(data: HttpRequestData): HttpResponseData
Link copied to clipboard
open fun install(client: HttpClient)
Link copied to clipboard
operator fun plusAssign(handler: MockRequestHandler)

Just a syntactic shortcut to enqueue.