WebServerDispatcher


@UnstableApi
public class WebServerDispatcher extends 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 methods

MockResponse
static WebServerDispatcher

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

static String

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

Public methods

dispatch

public MockResponse dispatch(RecordedRequest request)

forResources

public static WebServerDispatcher forResources(Iterable<WebServerDispatcher.Resource> resources)

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

getRequestPath

public static String getRequestPath(RecordedRequest request)

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