NAME

Mojo::Content - HTTP Content

SYNOPSIS

use Mojo::Content;

my $content = Mojo::Content->new;
$content->parse("Content-Length: 12\r\n\r\nHello World!");

DESCRIPTION

Mojo::Content is a generic container for HTTP content.

ATTRIBUTES

Mojo::Content inherits all attributes from Mojo::Stateful and implements the following new ones.

body_length

my $body_length = $content->body_length;

buffer

my $buffer = $content->buffer;
$content   = $content->buffer(Mojo::Buffer->new);

cache

my $cache = $content->cache;
$content  = $content->cache(Mojo::Cache->new);

filter_buffer

my $filter_buffer = $content->filter_buffer;
$content          = $content->filter_buffer(Mojo::Buffer->new);

header_length

my $header_length = $content->header_length;

headers

my $headers = $content->headers;
$content    = $content->headers(Mojo::Headers->new);

raw_header_length

my $raw_header_length = $content->raw_header_length;

raw_body_length

my $raw_body_length = $content->raw_body_length;

METHODS

Mojo::Content inherits all methods from Mojo::Stateful and implements the following new ones.

build_headers

my $string = $content->build_headers;

body_contains

my $found = $content->body_contains;

get_body_chunk

my $chunk = $content->get_body_chunk(0);

get_header_chunk

my $chunk = $content->get_header_chunk(13);

is_chunked

my $chunked = $content->is_chunked;

is_multipart

my $multipart = $content->is_multipart;

parse

$content = $content->parse("Content-Length: 12\r\n\r\nHello World!");