Group
Extension

Matches 7

Apache2-API ( J/JD/JDEGUEST/Apache2-API-v0.5.0.tar.gz, JDEGUEST, 2025; MetaCPAN )
Apache2-API/lib/Apache2/API.pm ( view source; MetaCPAN )
  use APR::Base64 ();
    use APR::Request ();
    use APR::UUID ();
    use Exporter ();
    use JSON ();
    use Scalar::Util ();
    our @EXPORT = qw( apr1_md5 );
    $DEBUG   = 0;
    $VERSION = '
age}->locale;
    }
    my $ctype = $self->response->content_type;
    if( $ctype eq 'application/json' )
    {
        return( $self->reply( $msg->{code}, { error => $msg->{message} } ) );
    }
    
 $rv );
}

sub decode_json
{
    my $self = shift( @_ );
    my $raw  = shift( @_ ) || return( $self->error( "No json data was provided to decode." ) );
    my $json = $self->json;
    my $hash;
    #
Apache2-API ( J/JD/JDEGUEST/Apache2-API-v0.5.0.tar.gz, JDEGUEST, 2025; MetaCPAN )
Apache2-API/lib/Apache2/API/Headers/Accept.pm ( view source; MetaCPAN )
ion/json');
    my $mime = $accept->match(['text/html', 'application/json']); # => 'text/html'
    # inspect client preferences (by q, desc):
    my $prefs = $a->preferences; # [ 'application/json', '
::Headers::Accept->new( '*/*;q=0.9, application/json;q=0.9' );
    $a->match( [ 'image/png', 'text/html', 'application/json' ] );
    # "application/json"

=head2 3. */* with higher q wins and chooses
 = Apache2::API::Headers::Accept->new( '*/*;q=1.0, application/json;q=0.9' );
    $a->match( [ 'image/png', 'text/html', 'application/json' ] );
    # "image/png"

=head1 LEGACY MATCH PRIORITY

Set C<
Apache2-API ( J/JD/JDEGUEST/Apache2-API-v0.5.0.tar.gz, JDEGUEST, 2025; MetaCPAN )
Apache2-API/lib/Apache2/API/Response.pm ( view source; MetaCPAN )
quest

See also L</status_line>

=head2 header

    $resp->header( 'Content-Type' => 'application/json' );
    my $ct = $resp->header( 'Content-Type' );

Sets or gets an HTTP header.

=head2 headers

pt} = 'application/json';
    $resp->headers->{Accept} = undef; # unset it

or

    my $accept = $resp->headers->get( 'Accept' );
    $resp->headers->set( Accept => 'application/json' );
    $resp->he
Apache2-API ( J/JD/JDEGUEST/Apache2-API-v0.5.0.tar.gz, JDEGUEST, 2025; MetaCPAN )
Apache2-API/lib/Apache2/API/Request.pm ( view source; MetaCPAN )
   use DateTime;
    use Encode ();
    use File::Which ();
    use HTTP::AcceptLanguage;
    use JSON ();
    use Module::Generic::HeaderValue;
    use Scalar::Util;
    use URI;
    use URI::Escape;
th( $auth ) );
        # Content-Type: application/json; charset=utf-8
        my $ctype_raw = $self->content_type;
        # Accept: application/json; version=1.0; charset=utf-8
        my $accept_ra
          $self->accept_charset( $accept_def->param( 'charset' ) );
        }

        my $json = $self->json;
        my $payload = $self->data;
        # An error occurred while reading the payload,
Apache2-API ( J/JD/JDEGUEST/Apache2-API-v0.5.0.tar.gz, JDEGUEST, 2025; MetaCPAN )
Apache2-API/lib/Apache2/API/Request/Upload.pm ( view source; MetaCPAN )
nt type is: %s\n", $up->info->{'Content-type'} );
    
    # could yield for example: application/json; charset=utf-8

See also L</type>, but be careful C<< $up->info->{'Content-type'} >> is not neces
Apache2-API ( J/JD/JDEGUEST/Apache2-API-v0.5.0.tar.gz, JDEGUEST, 2025; MetaCPAN )
Apache2-API/lib/Apache2/API/Headers/AcceptCommon.pm ( view source; MetaCPAN )
Apache2::API::Headers::Accept->new( 'text/html;q=0.9,application/json' );
    my $mime = $accept->match( ['text/html', 'application/json'] ); # => 'text/html'

    my $al = Apache2::API::Headers::Acce
 Apache2::API::Headers::Accept->new( 'text/html;q=0.9,application/json' );
    my $prefs  = $accept->preferences; # ['application/json', 'text/html']

If an error occurred, it sets an error that can b
Apache2-API ( J/JD/JDEGUEST/Apache2-API-v0.5.0.tar.gz, JDEGUEST, 2025; MetaCPAN )
Apache2-API/lib/Apache2/API/Status.pm ( view source; MetaCPAN )
 provide response to error in the user preferred language. L<Apache2::API/reply> uses it to set a json response with the HTTP error code along with a localised status message.

If no language code is 
e a link in the header. For example:

    POST /some/where HTTP/1.1
    Content-Type: application/json

Then the server response:

    HTTP/1.1 202 Accepted
    Link: </some/status/1234> rel="https://
TTP/Headers/Accept-Language> headers

For example:

    GET /foo HTTP/1.1
    Accept: application/json
    Accept-Language: fr-FR,en-GB;q=0.8,fr;q=0.6,en;q=0.4,ja;q=0.2

    HTTP/1.1 406 Not Acceptabl

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.