WebServerDispatcher


@UnstableApi
class WebServerDispatcher : Dispatcher


A Dispatcher for okhttp3.mockwebserver.MockWebServer that allows per-path customisation of the static data served.

Summary

Nested types

A resource served by WebServerDispatcher.

Builder for Resource.

Public functions

MockResponse!
java-static WebServerDispatcher!

Constructs a dispatcher that handles requests based the provided Resource instances.

java-static String!

Returns the path for a given RecordedRequest, stripping any query parameters.

Public functions

dispatch

fun dispatch(request: RecordedRequest!): MockResponse!

forResources

java-static fun forResources(
    resources: (Mutable)Iterable<WebServerDispatcher.Resource!>!
): WebServerDispatcher!

Constructs a dispatcher that handles requests based the provided Resource instances.

getRequestPath

java-static fun getRequestPath(request: RecordedRequest!): String!

Returns the path for a given RecordedRequest, stripping any query parameters.