org.http4k.strikt.httpMessage.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http4k-testing-strikt Show documentation
Show all versions of http4k-testing-strikt Show documentation
A set of Strikt matchers for common http4k types
package org.http4k.strikt
import org.http4k.core.HttpMessage
import org.http4k.format.Json
import org.http4k.lens.Header.CONTENT_TYPE
import org.http4k.lens.HeaderLens
import strikt.api.Assertion
fun Assertion.Builder.header(lens: HeaderLens) = get { lens(this) }
fun Assertion.Builder.header(name: String) = get { header(name) }
fun Assertion.Builder.headerValues(name: String) = get { headerValues(name) }
val Assertion.Builder.contentType get() = get { CONTENT_TYPE(this) }
val Assertion.Builder.body get() = get(HttpMessage::body)
val Assertion.Builder.bodyString get() = get { bodyString() }
fun Assertion.Builder.jsonBody(json: Json) = get { json.parse(bodyString()) }