.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Mojo::Headers 3"
.TH Mojo::Headers 3 "2023-03-08" "perl v5.26.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Mojo::Headers \- HTTP headers
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use Mojo::Headers;
\&
\& # Parse
\& my $headers = Mojo::Headers\->new;
\& $headers\->parse("Content\-Length: 42\ex0d\ex0a");
\& $headers\->parse("Content\-Type: text/html\ex0d\ex0a\ex0d\ex0a");
\& say $headers\->content_length;
\& say $headers\->content_type;
\&
\& # Build
\& my $headers = Mojo::Headers\->new;
\& $headers\->content_length(42);
\& $headers\->content_type(\*(Aqtext/plain\*(Aq);
\& say $headers\->to_string;
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Mojo::Headers is a container for \s-1HTTP\s0 headers, based on \s-1RFC 7230\s0 <https://tools.ietf.org/html/rfc7230> and \s-1RFC
7231\s0 <https://tools.ietf.org/html/rfc7231>.
.SH "ATTRIBUTES"
.IX Header "ATTRIBUTES"
Mojo::Headers implements the following attributes.
.SS "max_line_size"
.IX Subsection "max_line_size"
.Vb 2
\& my $size = $headers\->max_line_size;
\& $headers = $headers\->max_line_size(1024);
.Ve
.PP
Maximum header line size in bytes, defaults to the value of the \f(CW\*(C`MOJO_MAX_LINE_SIZE\*(C'\fR environment variable or \f(CW8192\fR
(8KiB).
.SS "max_lines"
.IX Subsection "max_lines"
.Vb 2
\& my $num = $headers\->max_lines;
\& $headers = $headers\->max_lines(200);
.Ve
.PP
Maximum number of header lines, defaults to the value of the \f(CW\*(C`MOJO_MAX_LINES\*(C'\fR environment variable or \f(CW100\fR.
.SH "METHODS"
.IX Header "METHODS"
Mojo::Headers inherits all methods from Mojo::Base and implements the following new ones.
.SS "accept"
.IX Subsection "accept"
.Vb 2
\& my $accept = $headers\->accept;
\& $headers = $headers\->accept(\*(Aqapplication/json\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Accept\*(C'\fR header.
.SS "accept_charset"
.IX Subsection "accept_charset"
.Vb 2
\& my $charset = $headers\->accept_charset;
\& $headers = $headers\->accept_charset(\*(AqUTF\-8\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Accept\-Charset\*(C'\fR header.
.SS "accept_encoding"
.IX Subsection "accept_encoding"
.Vb 2
\& my $encoding = $headers\->accept_encoding;
\& $headers = $headers\->accept_encoding(\*(Aqgzip\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Accept\-Encoding\*(C'\fR header.
.SS "accept_language"
.IX Subsection "accept_language"
.Vb 2
\& my $language = $headers\->accept_language;
\& $headers = $headers\->accept_language(\*(Aqde, en\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Accept\-Language\*(C'\fR header.
.SS "accept_ranges"
.IX Subsection "accept_ranges"
.Vb 2
\& my $ranges = $headers\->accept_ranges;
\& $headers = $headers\->accept_ranges(\*(Aqbytes\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Accept\-Ranges\*(C'\fR header.
.SS "access_control_allow_origin"
.IX Subsection "access_control_allow_origin"
.Vb 2
\& my $origin = $headers\->access_control_allow_origin;
\& $headers = $headers\->access_control_allow_origin(\*(Aq*\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Access\-Control\-Allow\-Origin\*(C'\fR header from Cross-Origin
Resource Sharing <https://www.w3.org/TR/cors/>.
.SS "add"
.IX Subsection "add"
.Vb 2
\& $headers = $headers\->add(Foo => \*(Aqone value\*(Aq);
\& $headers = $headers\->add(Foo => \*(Aqfirst value\*(Aq, \*(Aqsecond value\*(Aq);
.Ve
.PP
Add header with one or more lines.
.PP
.Vb 3
\& # "Vary: Accept
\& # Vary: Accept\-Encoding"
\& $headers\->add(Vary => \*(AqAccept\*(Aq)\->add(Vary => \*(AqAccept\-Encoding\*(Aq)\->to_string;
.Ve
.SS "allow"
.IX Subsection "allow"
.Vb 2
\& my $allow = $headers\->allow;
\& $headers = $headers\->allow(\*(AqGET, POST\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Allow\*(C'\fR header.
.SS "append"
.IX Subsection "append"
.Vb 1
\& $headers = $headers\->append(Vary => \*(AqAccept\-Encoding\*(Aq);
.Ve
.PP
Append value to header and flatten it if necessary.
.PP
.Vb 2
\& # "Vary: Accept"
\& $headers\->append(Vary => \*(AqAccept\*(Aq)\->to_string;
\&
\& # "Vary: Accept, Accept\-Encoding"
\& $headers\->vary(\*(AqAccept\*(Aq)\->append(Vary => \*(AqAccept\-Encoding\*(Aq)\->to_string;
.Ve
.SS "authorization"
.IX Subsection "authorization"
.Vb 2
\& my $authorization = $headers\->authorization;
\& $headers = $headers\->authorization(\*(AqBasic Zm9vOmJhcg==\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Authorization\*(C'\fR header.
.SS "cache_control"
.IX Subsection "cache_control"
.Vb 2
\& my $cache_control = $headers\->cache_control;
\& $headers = $headers\->cache_control(\*(Aqmax\-age=1, no\-cache\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Cache\-Control\*(C'\fR header.
.SS "clone"
.IX Subsection "clone"
.Vb 1
\& my $clone = $headers\->clone;
.Ve
.PP
Return a new Mojo::Headers object cloned from these headers.
.SS "connection"
.IX Subsection "connection"
.Vb 2
\& my $connection = $headers\->connection;
\& $headers = $headers\->connection(\*(Aqclose\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Connection\*(C'\fR header.
.SS "content_disposition"
.IX Subsection "content_disposition"
.Vb 2
\& my $disposition = $headers\->content_disposition;
\& $headers = $headers\->content_disposition(\*(Aqfoo\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Content\-Disposition\*(C'\fR header.
.SS "content_encoding"
.IX Subsection "content_encoding"
.Vb 2
\& my $encoding = $headers\->content_encoding;
\& $headers = $headers\->content_encoding(\*(Aqgzip\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Content\-Encoding\*(C'\fR header.
.SS "content_language"
.IX Subsection "content_language"
.Vb 2
\& my $language = $headers\->content_language;
\& $headers = $headers\->content_language(\*(Aqen\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Content\-Language\*(C'\fR header.
.SS "content_length"
.IX Subsection "content_length"
.Vb 2
\& my $len = $headers\->content_length;
\& $headers = $headers\->content_length(4000);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Content\-Length\*(C'\fR header.
.SS "content_location"
.IX Subsection "content_location"
.Vb 2
\& my $location = $headers\->content_location;
\& $headers = $headers\->content_location(\*(Aqhttp://127.0.0.1/foo\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Content\-Location\*(C'\fR header.
.SS "content_range"
.IX Subsection "content_range"
.Vb 2
\& my $range = $headers\->content_range;
\& $headers = $headers\->content_range(\*(Aqbytes 2\-8/100\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Content\-Range\*(C'\fR header.
.SS "content_security_policy"
.IX Subsection "content_security_policy"
.Vb 2
\& my $policy = $headers\->content_security_policy;
\& $headers = $headers\->content_security_policy(\*(Aqdefault\-src https:\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Content\-Security\-Policy\*(C'\fR header from Content Security Policy
1.0 <https://www.w3.org/TR/CSP/>.
.SS "content_type"
.IX Subsection "content_type"
.Vb 2
\& my $type = $headers\->content_type;
\& $headers = $headers\->content_type(\*(Aqtext/plain\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Content\-Type\*(C'\fR header.
.SS "cookie"
.IX Subsection "cookie"
.Vb 2
\& my $cookie = $headers\->cookie;
\& $headers = $headers\->cookie(\*(Aqf=b\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Cookie\*(C'\fR header from \s-1RFC
6265\s0 <https://tools.ietf.org/html/rfc6265>.
.SS "date"
.IX Subsection "date"
.Vb 2
\& my $date = $headers\->date;
\& $headers = $headers\->date(\*(AqSun, 17 Aug 2008 16:27:35 GMT\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Date\*(C'\fR header.
.SS "dehop"
.IX Subsection "dehop"
.Vb 1
\& $headers = $headers\->dehop;
.Ve
.PP
Remove hop-by-hop headers that should not be retransmitted.
.SS "dnt"
.IX Subsection "dnt"
.Vb 2
\& my $dnt = $headers\->dnt;
\& $headers = $headers\->dnt(1);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`DNT\*(C'\fR (Do Not Track) header, which has no specification yet, but
is very commonly used.
.SS "etag"
.IX Subsection "etag"
.Vb 2
\& my $etag = $headers\->etag;
\& $headers = $headers\->etag(\*(Aq"abc321"\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`ETag\*(C'\fR header.
.SS "every_header"
.IX Subsection "every_header"
.Vb 1
\& my $all = $headers\->every_header(\*(AqLocation\*(Aq);
.Ve
.PP
Similar to \*(L"header\*(R", but returns all headers sharing the same name as an array reference.
.PP
.Vb 2
\& # Get first header value
\& say $headers\->every_header(\*(AqLocation\*(Aq)\->[0];
.Ve
.SS "expect"
.IX Subsection "expect"
.Vb 2
\& my $expect = $headers\->expect;
\& $headers = $headers\->expect(\*(Aq100\-continue\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Expect\*(C'\fR header.
.SS "expires"
.IX Subsection "expires"
.Vb 2
\& my $expires = $headers\->expires;
\& $headers = $headers\->expires(\*(AqThu, 01 Dec 1994 16:00:00 GMT\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Expires\*(C'\fR header.
.SS "from_hash"
.IX Subsection "from_hash"
.Vb 3
\& $headers = $headers\->from_hash({\*(AqCookie\*(Aq => \*(Aqa=b\*(Aq});
\& $headers = $headers\->from_hash({\*(AqCookie\*(Aq => [\*(Aqa=b\*(Aq, \*(Aqc=d\*(Aq]});
\& $headers = $headers\->from_hash({});
.Ve
.PP
Parse headers from a hash reference, an empty hash removes all headers.
.SS "header"
.IX Subsection "header"
.Vb 3
\& my $value = $headers\->header(\*(AqFoo\*(Aq);
\& $headers = $headers\->header(Foo => \*(Aqone value\*(Aq);
\& $headers = $headers\->header(Foo => \*(Aqfirst value\*(Aq, \*(Aqsecond value\*(Aq);
.Ve
.PP
Get or replace the current header values.
.SS "host"
.IX Subsection "host"
.Vb 2
\& my $host = $headers\->host;
\& $headers = $headers\->host(\*(Aq127.0.0.1\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Host\*(C'\fR header.
.SS "if_modified_since"
.IX Subsection "if_modified_since"
.Vb 2
\& my $date = $headers\->if_modified_since;
\& $headers = $headers\->if_modified_since(\*(AqSun, 17 Aug 2008 16:27:35 GMT\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`If\-Modified\-Since\*(C'\fR header.
.SS "if_none_match"
.IX Subsection "if_none_match"
.Vb 2
\& my $etag = $headers\->if_none_match;
\& $headers = $headers\->if_none_match(\*(Aq"abc321"\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`If\-None\-Match\*(C'\fR header.
.SS "is_finished"
.IX Subsection "is_finished"
.Vb 1
\& my $bool = $headers\->is_finished;
.Ve
.PP
Check if header parser is finished.
.SS "is_limit_exceeded"
.IX Subsection "is_limit_exceeded"
.Vb 1
\& my $bool = $headers\->is_limit_exceeded;
.Ve
.PP
Check if headers have exceeded \*(L"max_line_size\*(R" or \*(L"max_lines\*(R".
.SS "last_modified"
.IX Subsection "last_modified"
.Vb 2
\& my $date = $headers\->last_modified;
\& $headers = $headers\->last_modified(\*(AqSun, 17 Aug 2008 16:27:35 GMT\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Last\-Modified\*(C'\fR header.
.SS "leftovers"
.IX Subsection "leftovers"
.Vb 1
\& my $bytes = $headers\->leftovers;
.Ve
.PP
Get and remove leftover data from header parser.
.SS "link"
.IX Subsection "link"
.Vb 2
\& my $link = $headers\->link;
\& $headers = $headers\->link(\*(Aq<http://127.0.0.1/foo/3>; rel="next"\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Link\*(C'\fR header from \s-1RFC
5988\s0 <https://tools.ietf.org/html/rfc5988>.
.SS "links"
.IX Subsection "links"
.Vb 2
\& my $links = $headers\->links;
\& $headers = $headers\->links({next => \*(Aqhttp://example.com/foo\*(Aq, prev => \*(Aqhttp://example.com/bar\*(Aq});
.Ve
.PP
Get or set web links from or to \f(CW\*(C`Link\*(C'\fR header according to \s-1RFC 5988\s0 <http://tools.ietf.org/html/rfc5988>.
.PP
.Vb 3
\& # Extract information about next page
\& say $headers\->links\->{next}{link};
\& say $headers\->links\->{next}{title};
.Ve
.SS "location"
.IX Subsection "location"
.Vb 2
\& my $location = $headers\->location;
\& $headers = $headers\->location(\*(Aqhttp://127.0.0.1/foo\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Location\*(C'\fR header.
.SS "names"
.IX Subsection "names"
.Vb 1
\& my $names = $headers\->names;
.Ve
.PP
Return an array reference with all currently defined headers.
.PP
.Vb 2
\& # Names of all headers
\& say for @{$headers\->names};
.Ve
.SS "origin"
.IX Subsection "origin"
.Vb 2
\& my $origin = $headers\->origin;
\& $headers = $headers\->origin(\*(Aqhttp://example.com\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Origin\*(C'\fR header from \s-1RFC
6454\s0 <https://tools.ietf.org/html/rfc6454>.
.SS "parse"
.IX Subsection "parse"
.Vb 1
\& $headers = $headers\->parse("Content\-Type: text/plain\ex0d\ex0a\ex0d\ex0a");
.Ve
.PP
Parse formatted headers.
.SS "proxy_authenticate"
.IX Subsection "proxy_authenticate"
.Vb 2
\& my $authenticate = $headers\->proxy_authenticate;
\& $headers = $headers\->proxy_authenticate(\*(AqBasic "realm"\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Proxy\-Authenticate\*(C'\fR header.
.SS "proxy_authorization"
.IX Subsection "proxy_authorization"
.Vb 2
\& my $authorization = $headers\->proxy_authorization;
\& $headers = $headers\->proxy_authorization(\*(AqBasic Zm9vOmJhcg==\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Proxy\-Authorization\*(C'\fR header.
.SS "range"
.IX Subsection "range"
.Vb 2
\& my $range = $headers\->range;
\& $headers = $headers\->range(\*(Aqbytes=2\-8\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Range\*(C'\fR header.
.SS "referer"
.IX Subsection "referer"
.Vb 2
\& my $referrer = $headers\->referer;
\& $headers = $headers\->referer(\*(Aqhttp://example.com\*(Aq);
.Ve
.PP
Alias for \*(L"referrer\*(R".
.SS "referrer"
.IX Subsection "referrer"
.Vb 2
\& my $referrer = $headers\->referrer;
\& $headers = $headers\->referrer(\*(Aqhttp://example.com\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Referer\*(C'\fR header, there was a typo in \s-1RFC
2068\s0 <https://tools.ietf.org/html/rfc2068> which resulted in \f(CW\*(C`Referer\*(C'\fR becoming an official header.
.SS "remove"
.IX Subsection "remove"
.Vb 1
\& $headers = $headers\->remove(\*(AqFoo\*(Aq);
.Ve
.PP
Remove a header.
.SS "sec_websocket_accept"
.IX Subsection "sec_websocket_accept"
.Vb 2
\& my $accept = $headers\->sec_websocket_accept;
\& $headers = $headers\->sec_websocket_accept(\*(Aqs3pPLMBiTxaQ9kYGzzhZRbK+xOo=\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Sec\-WebSocket\-Accept\*(C'\fR header from \s-1RFC
6455\s0 <https://tools.ietf.org/html/rfc6455>.
.SS "sec_websocket_extensions"
.IX Subsection "sec_websocket_extensions"
.Vb 2
\& my $extensions = $headers\->sec_websocket_extensions;
\& $headers = $headers\->sec_websocket_extensions(\*(Aqfoo\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Sec\-WebSocket\-Extensions\*(C'\fR header from \s-1RFC
6455\s0 <https://tools.ietf.org/html/rfc6455>.
.SS "sec_websocket_key"
.IX Subsection "sec_websocket_key"
.Vb 2
\& my $key = $headers\->sec_websocket_key;
\& $headers = $headers\->sec_websocket_key(\*(AqdGhlIHNhbXBsZSBub25jZQ==\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Sec\-WebSocket\-Key\*(C'\fR header from \s-1RFC
6455\s0 <https://tools.ietf.org/html/rfc6455>.
.SS "sec_websocket_protocol"
.IX Subsection "sec_websocket_protocol"
.Vb 2
\& my $proto = $headers\->sec_websocket_protocol;
\& $headers = $headers\->sec_websocket_protocol(\*(Aqsample\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Sec\-WebSocket\-Protocol\*(C'\fR header from \s-1RFC
6455\s0 <https://tools.ietf.org/html/rfc6455>.
.SS "sec_websocket_version"
.IX Subsection "sec_websocket_version"
.Vb 2
\& my $version = $headers\->sec_websocket_version;
\& $headers = $headers\->sec_websocket_version(13);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Sec\-WebSocket\-Version\*(C'\fR header from \s-1RFC
6455\s0 <https://tools.ietf.org/html/rfc6455>.
.SS "server"
.IX Subsection "server"
.Vb 2
\& my $server = $headers\->server;
\& $headers = $headers\->server(\*(AqMojo\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Server\*(C'\fR header.
.SS "server_timing"
.IX Subsection "server_timing"
.Vb 2
\& my $timing = $headers\->server_timing;
\& $headers = $headers\->server_timing(\*(Aqapp;desc=Mojolicious;dur=0.0001\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Server\-Timing\*(C'\fR header from Server
Timing <https://www.w3.org/TR/server-timing/>.
.SS "set_cookie"
.IX Subsection "set_cookie"
.Vb 2
\& my $cookie = $headers\->set_cookie;
\& $headers = $headers\->set_cookie(\*(Aqf=b; path=/\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Set\-Cookie\*(C'\fR header from \s-1RFC
6265\s0 <https://tools.ietf.org/html/rfc6265>.
.SS "status"
.IX Subsection "status"
.Vb 2
\& my $status = $headers\->status;
\& $headers = $headers\->status(\*(Aq200 OK\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Status\*(C'\fR header from \s-1RFC
3875\s0 <https://tools.ietf.org/html/rfc3875>.
.SS "strict_transport_security"
.IX Subsection "strict_transport_security"
.Vb 2
\& my $policy = $headers\->strict_transport_security;
\& $headers = $headers\->strict_transport_security(\*(Aqmax\-age=31536000\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Strict\-Transport\-Security\*(C'\fR header from \s-1RFC
6797\s0 <https://tools.ietf.org/html/rfc6797>.
.SS "te"
.IX Subsection "te"
.Vb 2
\& my $te = $headers\->te;
\& $headers = $headers\->te(\*(Aqchunked\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`TE\*(C'\fR header.
.SS "to_hash"
.IX Subsection "to_hash"
.Vb 2
\& my $single = $headers\->to_hash;
\& my $multi = $headers\->to_hash(1);
.Ve
.PP
Turn headers into hash reference, array references to represent multiple headers with the same name are disabled by
default.
.PP
.Vb 1
\& say $headers\->to_hash\->{DNT};
.Ve
.SS "to_string"
.IX Subsection "to_string"
.Vb 1
\& my $str = $headers\->to_string;
.Ve
.PP
Turn headers into a string, suitable for \s-1HTTP\s0 messages.
.SS "trailer"
.IX Subsection "trailer"
.Vb 2
\& my $trailer = $headers\->trailer;
\& $headers = $headers\->trailer(\*(AqX\-Foo\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Trailer\*(C'\fR header.
.SS "transfer_encoding"
.IX Subsection "transfer_encoding"
.Vb 2
\& my $encoding = $headers\->transfer_encoding;
\& $headers = $headers\->transfer_encoding(\*(Aqchunked\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Transfer\-Encoding\*(C'\fR header.
.SS "upgrade"
.IX Subsection "upgrade"
.Vb 2
\& my $upgrade = $headers\->upgrade;
\& $headers = $headers\->upgrade(\*(Aqwebsocket\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Upgrade\*(C'\fR header.
.SS "user_agent"
.IX Subsection "user_agent"
.Vb 2
\& my $agent = $headers\->user_agent;
\& $headers = $headers\->user_agent(\*(AqMojo/1.0\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`User\-Agent\*(C'\fR header.
.SS "vary"
.IX Subsection "vary"
.Vb 2
\& my $vary = $headers\->vary;
\& $headers = $headers\->vary(\*(Aq*\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`Vary\*(C'\fR header.
.SS "www_authenticate"
.IX Subsection "www_authenticate"
.Vb 2
\& my $authenticate = $headers\->www_authenticate;
\& $headers = $headers\->www_authenticate(\*(AqBasic realm="realm"\*(Aq);
.Ve
.PP
Get or replace current header value, shortcut for the \f(CW\*(C`WWW\-Authenticate\*(C'\fR header.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.