NAME

Raisin::Middleware::Formatter - A parser/formatter middleware for Raisin.

DESCRIPTION

Parses and formats the data it gets from requests and responses if it's needed.

METHODS

negotiate_format

Negotiates a format from path extension, Accept header or using default format.

A precedence is following:

  • extension; =item * Accept header; =item * default;

In other words if an extension exists the framework doesn't look for Accept header. If the extension is not supported the framework throws an error, the same is for Accept header. Only if both extension and Accept header are not specified it fallback to default format.

format_from_extension

Extracts an extension from a path, and if exists looks for a formatter.

format_from_header

Parses Accept header for known formatters.

AUTHOR

Artur Khabibullin - rtkh <at> cpan.org

LICENSE

This module and all the modules in this package are governed by the same license as Perl itself.