-module(plume@referrer_policy).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/plume/referrer_policy.gleam").
-export([to_string/1]).
-export_type([referrer_policy/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Referrer-Policy\n"
"\n"
" This response header controls how much referrer information (sent via the\n"
" `Referer` header) should be included with requests made from a document.\n"
" Restricting referrer information helps protect user privacy and can prevent\n"
" leaking sensitive data contained in URLs (such as session identifiers or\n"
" internal paths) to third-party sites.\n"
"\n"
" In the descriptions below, \"full URL\" refers to the origin, path, and\n"
" query string; the fragment is always stripped from the `Referer` header.\n"
"\n"
" See the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy).\n"
).
-type referrer_policy() :: no_referrer |
no_referrer_when_downgrade |
origin |
origin_when_cross_origin |
same_origin |
strict_origin |
strict_origin_when_cross_origin |
unsafe_url.
-file("src/plume/referrer_policy.gleam", 41).
?DOC(" Encode as the `Referrer-Policy` header value.\n").
-spec to_string(referrer_policy()) -> binary().
to_string(Value) ->
case Value of
no_referrer ->
<<"no-referrer"/utf8>>;
no_referrer_when_downgrade ->
<<"no-referrer-when-downgrade"/utf8>>;
origin ->
<<"origin"/utf8>>;
origin_when_cross_origin ->
<<"origin-when-cross-origin"/utf8>>;
same_origin ->
<<"same-origin"/utf8>>;
strict_origin ->
<<"strict-origin"/utf8>>;
strict_origin_when_cross_origin ->
<<"strict-origin-when-cross-origin"/utf8>>;
unsafe_url ->
<<"unsafe-url"/utf8>>
end.