WebServerDispatcher
@UnstableApi
public final class WebServerDispatcher extends Dispatcher
| java.lang.Object | ||
| ↳ | okhttp3.mockwebserver.Dispatcher | |
| ↳ | androidx.media3.test.utils.WebServerDispatcher |
A Dispatcher for okhttp3.mockwebserver.MockWebServer that allows per-path customisation of the static data served.
Summary
Nested types |
|---|
public final class WebServerDispatcher.ResourceA resource served by |
public final class WebServerDispatcher.Resource.BuilderBuilder for |
Constants |
|
|---|---|
static final String |
NOT_FOUND_BODY = "Resource not found!"The body associated with a response for an unrecognized path. |
Public methods |
|
|---|---|
MockResponse |
dispatch(RecordedRequest request) |
static WebServerDispatcher |
forResources(Iterable<WebServerDispatcher.Resource> resources)Constructs a dispatcher that handles requests based the provided |
static String |
getRequestPath(RecordedRequest request)Returns the path for a given |
Inherited methods |
||||
|---|---|---|---|---|
|
Constants
NOT_FOUND_BODY
public static final String NOT_FOUND_BODY = "Resource not found!"
The body associated with a response for an unrecognized path.
Public methods
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.