Name

SPVM::HTTP::Minimal - HTTP Client

Description

The HTTP::Minimal class of SPVM has methods for a HTTP client.

Usage

use HTTP::Minimal;

my $url = "http://google.com";

my $http = HTTP::Minimal->new;

my $res = $http->get($url);

my $content = $res->content;

Fields

agent

has agent : ro string;

The user agent.

timeout

has timeout : ro double;

The request timeout seconds.

Class Methods

new

static method new : HTTP::Minimal ($options : object[] = undef);

Creates a new HTTP::Minimal object.

Options:

agent : string

Sets the "agent" field.

timeout : Double

Sets the "timeout" field.

Instance Methods

get

method get : HTTP::Minimal::Message::Response ($url : string, $options : object[] = undef);

Gets the HTTP response by sending an HTTP GET request to the URL $url.

The HTTP response is a HTTP::Minimal::Message::Response object.

Options:

headers : HTTP::Minimal::Headers

Headers for an HTTP request.

timeout : Double

Timeout seconds.

method head : HTTP::Minimal::Message::Response ($url : string, $options : object[] = undef);

put

method put : HTTP::Minimal::Message::Response ($url : string, $options : object[] = undef);

post

method post : HTTP::Minimal::Message::Response ($url : string, $options : object[] = undef);

patch

method patch : HTTP::Minimal::Message::Response ($url : string, $options : object[] = undef);

delete

method delete : HTTP::Minimal::Message::Response ($url : string, $options : object[] = undef);

Repository

SPVM::HTTP::Minimal - Github

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License