Skip to content

akhial/mock-server-dsl

Repository files navigation

Mock Server DSL

MIT licensed

A DSL to define Dispatchers for OkHttp MockWebServer.

Example

val server = MockWebServer()

val dispatcher = mockResponses {
    matchBody("foo") { MockResponse().setResponseCode(201) }
    matchPath("bar") { MockResponse().setResponseCode(200).setBody("baz") }
    matchMethod("GET") { MockResponse().setResponseCode(403) }
    matchMethod("POST") { MockResponse().setResponseCode(200) }
}

server.dispatcher = dispatcher

License

mock-server-dsl is provided under the MIT license.

About

A DSL to define dispatchers for MockWebServer.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages