packages

http::cookie

On this page

Cookies (RFC 6265): the Cookie request header and Set-Cookie.

Structs

SetCookieSource

pub struct SetCookie

A Set-Cookie header. expires is kept as written (an HTTP date).

  • pub name: str§

    Source
  • pub value: str§

    Source
  • pub expires: str | none = none§

    Source
  • pub max_age: i64 | none = none§

    Source
  • pub domain: str | none = none§

    Source
  • pub path: str | none = none§

    Source
  • pub secure: bool = false§

    Source
  • pub http_only: bool = false§

    Source
  • pub same_site: str | none = none§

    Source

    Strict, Lax or None.

  • pub fn parse(s: str) -> SetCookie | none§

    Source

    Parse as a user agent does: none when there is no = or the name is empty; unknown or malformed attributes are ignored.

  • pub fn to_header(self) throws (HttpError) -> str§

    Source

    The header value; throws if the name, value or an attribute could break the header.

Functions

cookie_headerSource

pub fn cookie_header(pairs: List<(str, str)>) throws (HttpError) -> str

A Cookie header value from pairs; throws on an invalid name or value.