MPMinus

 view release on metacpan or  search on metacpan

lib/MPMinus/REST.pm  view on Meta::CPAN

    return Apache2::Const::DECLINED;
}
sub hType { # Type: RUN_FIRST
    my $self = shift;
    my $r = shift;

    my $meth = uc($r->method() || 'GET');
    my $is_get = $meth =~ /GET|HEAD/ ? 1 : 0;
    my $headers = $r->headers_in(); # APR::Table object

    # If content-type is predefined! Nothing to do
    my $content_type = $self->get_attr("content_type");
    if ($content_type) {
        $self->set_svar(format => _ctlookup($content_type) || FORMAT);
        $r->content_type($content_type);
        return Apache2::Const::OK;
    }

    # Content-Type Values from headers
    my $req_content_type = $headers->get("content-type") // '';
    my $req_accept = $headers->get("accept") // '';

    # Try get format from request header first and from the Accept header
    my $format = _ctlookup($req_content_type) || _ctlookup($req_accept);
    my $default_format = $format || FORMAT;
    my $default_content_type = $req_content_type || _format2ct($default_format) || CONTENT_TYPE;

    # If handler not exists
    unless ($self->get_svar("is_exists")) {
        $self->set_svar(format => $default_format);



( run in 0.484 second using v1.01-cache-2.11-cpan-d7f47b0818f )