View Source CookieJar.Cookie (cookie_jar v1.1.0)

Model individual Cookie as specified by the MDN doc Some of the functionalities are irrelevant so only the following attributes are kept: domain, include_subdomain, path, secure, expires, name and value

Summary

Functions

Return true if cookie2 is superseding cookie1. Only compare domain, path and name.

Return true if the cookie shall be sent to the uri

simple constructor

parse a cookie from the Set-Cookie: value. return nil if no valid cookie found

parse a cookie from the Set-Cookie: value. return nil if no valid cookie found taking additional infomatio ffrom the requesting URI

return name=value as string

Types

t()

@type t() :: %CookieJar.Cookie{
  domain: String.t(),
  expires: integer(),
  include_subdomain: boolean(),
  name: String.t(),
  path: String.t(),
  secure: boolean(),
  value: String.t()
}

Functions

equal?(cookie1, cookie2)

@spec equal?(t(), t()) :: boolean()

Return true if cookie2 is superseding cookie1. Only compare domain, path and name.

matched?(cookie, uri)

@spec matched?(t(), URI.t()) :: boolean()

Return true if the cookie shall be sent to the uri

new(name, value)

@spec new(String.t(), String.t()) :: t()

simple constructor

parse(set_cookie)

@spec parse(String.t()) :: nil | t()

parse a cookie from the Set-Cookie: value. return nil if no valid cookie found

parse(set_cookie, uri)

@spec parse(String.t(), nil | URI.t()) :: nil | t()

parse a cookie from the Set-Cookie: value. return nil if no valid cookie found taking additional infomatio ffrom the requesting URI

to_string(cookie)

@spec to_string(t()) :: String.t()

return name=value as string