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

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

package org.http4k.hamkrest

import com.natpryce.hamkrest.Matcher
import com.natpryce.hamkrest.equalTo
import com.natpryce.hamkrest.has
import org.http4k.core.cookie.Cookie
import java.time.LocalDateTime

fun hasCookieName(expected: String): Matcher = has(Cookie::name, equalTo(expected))

fun hasCookieValue(expected: String): Matcher = has(Cookie::value, equalTo(expected))

fun hasCookieDomain(expected: String): Matcher = has("domain", { c: Cookie -> c.domain }, equalTo(expected))

fun hasCookiePath(expected: String): Matcher = has("path", { c: Cookie -> c.path }, equalTo(expected))

fun isSecureCookie(expected: Boolean = true): Matcher = has("secure", { c: Cookie -> c.secure }, equalTo(expected))

fun isHttpOnlyCookie(expected: Boolean = true): Matcher = has("httpOnly", { c: Cookie -> c.httpOnly }, equalTo(expected))

fun hasCookieExpiry(expected: LocalDateTime): Matcher = hasCookieExpiry(equalTo(expected))

fun hasCookieExpiry(expected: Matcher): Matcher = has("expiry", { c: Cookie -> c.expires!! }, expected)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy