All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.hamkrest.response.kt Maven / Gradle / Ivy

There is a newer version: 5.41.0.0
Show newest version
package org.http4k.hamkrest

import com.natpryce.hamkrest.Matcher
import com.natpryce.hamkrest.equalTo
import org.http4k.core.Response
import org.http4k.core.Status
import org.http4k.core.cookie.Cookie
import org.http4k.core.cookie.cookies

fun hasStatus(expected: Status): Matcher = httpMessageHas("Status", Response::status, equalTo(expected))

fun hasStatusDescription(expected: String): Matcher =
    httpMessageHas("Status description",{ it.status.description }, equalTo(expected))

fun hasSetCookie(expected: Cookie): Matcher = hasSetCookie(expected.name, equalTo(expected))

fun hasSetCookie(name: String, expected: Matcher): Matcher = httpMessageHas("Cookie '$name'", { r: Response -> r.cookies().find { name == it.name }!! }, expected)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy