An open API service indexing awesome lists of open source software.

https://github.com/skrapeit/wiremock-kotlin

Kotlin DSL support for WireMock
https://github.com/skrapeit/wiremock-kotlin

Last synced: 2 months ago
JSON representation

Kotlin DSL support for WireMock

Awesome Lists containing this project

README

          

wiremock-kotlin [![CI build status](https://github.com/skrapeit/wiremock-kotlin/workflows/CI/badge.svg)](https://github.com/skrapeit/wiremock-kotlin/actions?query=workflow%3ACI)
===============

Create WireMock stubs via Kotlin DSL

## Example

```kotlin
data class Song(val title: String)

stubFor {
get {
url equalTo "/my-api"
willReturn {

headers = mapOf("Content-Type" to "application/json")

body jsonFromObject Song("The revenge of Vera Gemini")
}
}

post {
url matching "/your/([a-z]*)\\?and=query"

willReturn {
status = 201
body.file("my/path/example.json")
fixedDelay {
milliseconds = 3000
}
}
}
}
```