NAME
Mojo::Message - Message Base Class
SYNOPSIS
use base 'Mojo::Message';
DESCRIPTION
Mojo::Message is a base class for HTTP messages.
ATTRIBUTES
Mojo::Message inherits all attributes from Mojo::Stateful and implements the following new ones.
body_length
my $body_length = $message->body_length;
buffer
my $buffer = $message->buffer;
$message = $message->buffer(Mojo::Buffer->new);
build_start_line_cb
build_start_line_callback
my $cb = $message->build_start_line_cb;
my $cb = $message->build_start_line_callback;
$message = $content->build_start_line_callback(sub {
return "HTTP/1.1 200 OK\r\n\r\n";
});
content
my $content = $message->content;
$message = $message->content(Mojo::Content->new);
header_length
my $header_length = $message->header_length;
headers
my $headers = $message->headers;
$message = $message->headers(Mojo::Headers->new);
major_version
my $major_version = $message->major_version;
$message = $message->major_version(1);
minor_version
my $minor_version = $message->minor_version;
$message = $message->minor_version(1);
prepare_builder_cb
prepare_builder_callback
my $cb = $message->prepare_builder_cb;
my $cb = $message->prepare_builder_callback;
$message = $message->prepare_builder_callback(sub {
my $self = shift;
# Do stuff! :)
});
prepare_parser_cb
prepare_parser_callback
my $cb = $message->prepare_parser_cb;
my $cb = $message->prepare_parser_callback;
$message = $message->prepare_parser_callback(sub {
my $self = shift;
# Do stuff! :)
});
raw_body_length
my $raw_body_length = $message->raw_body_length;
start_line_length
my $start_line_length = $message->start_line_length;
version
my $version = $message->version;
$message = $message->version('1.1');
METHODS
Mojo::Message inherits all methods from Mojo::Stateful and implements the following new ones.
body
my $string = $message->body;
$message = $message->body('Hello!');
body_params
body_parameters
my $params = $message->body_params;
my $params = $message->body_parameters;
to_string
build
my $string = $message->build;
build_body
my $string = $message->build_body;
build_headers
my $string = $message->build_headers;
build_start_line
my $string = $message->build_start_line;
fix_headers
$message = $message->fix_headers;
get_body_chunk
my $string = $message->get_body_chunk($offset);
get_header_chunk
my $string = $message->get_header_chunk($offset);
get_start_line_chunk
my $string = $message->get_start_line_chunk($offset);
is_chunked
my $is_chunked = $message->is_chunked;
is_multipart
my $is_multipart = $message->is_multipart;
is_version
my $is_version = $message->is_version('1.1);
parse
$message = $message->parse('HTTP/1.1 200 OK...');
uploads
my $uploads = $message->uploads;