Name

SPVM::HTTP::Tiny::Headers - HTTP Headers

Description

The HTTP::Tiny::Headers class of SPVM has methods to manipulate HTTP headers.

Usage

my $headers = HTTP::Tiny::Headers->new;

$headers->add("Foo", "one value");

my $header_value = $headers->header("Foo");

Class Methods

new

static method new : HTTP::Tiny::Headers ();

Creates a new HTTP::Tiny::Headers object, and returns it.

Instance Methods

add

method add : void ($name : string, $value : string);

Adds a header name $name and its value $value.

remove

method remove : void ($name : string);

Removes a header given its name $name.

method header : string ($name : string);

Gets a header value given its name $name.

set_header

method set_header : void ($name : string, $value : string);

Set a header value $value given its name $name.

names

method names : string[] ();

Returns header names.

to_string

method to_string : string ();

Converts all headers to a string, and returns it.

clone

method clone : HTTP::Tiny::Headers ();

Clones this headers, and returns it.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License