Scoop API

scoop:scoop.http.client:0.1.0

src/cookie/options.scoop

Selected production source · src/cookie/options.scoop

1package scoop.http.client
3import scoop.http.HttpCookieHeader
4import scoop.http.HttpResponseHead
5import scoop.url.Url
6import scoop.url.UrlOrigin
8/**
9 * Suspendable request-cookie selection and response-cookie storage. Implementations define
10 * persistence and context policy.
11 */
12public interface CookieJar {
13 /**
14 * Selects cookie pairs for the request URL and available request context.
15 */
16 public suspend fun load(request: HttpRequest): HttpCookieHeader
17 /**
18 * Processes each response Set-Cookie field for the request URL.
19 */
20 public suspend fun save(request: HttpRequest, response: HttpResponseHead)
23/**
24 * The initiating site and top-level-navigation context used when a cookie jar enforces SameSite.
25 */
26public class HttpCookieContext public constructor(
27 /**
28 * The initiating site URL used for schemeful SameSite comparison, when known.
29 */
30 public val site: Url? = None,
31 /**
32 * Whether this request is a top-level navigation.
33 */
34 public val isTopLevelNavigation: Boolean = false
35) {
36 internal val origin: UrlOrigin? = if (clientPresent(site)) Some(site!!.httpOrigin()) else None