Apache2-API

 view release on metacpan or  search on metacpan

lib/Apache2/API.pm  view on Meta::CPAN


        # The property 'code' could exist, but be undefined, or even empty, so we check for that.
        unless( exists( $ref->{error}->{code} ) &&
                defined( $ref->{error}->{code} ) &&
                length( $ref->{error}->{code} ) )
        {
            $ref->{error}->{code} = $code;
        }
        $ref->{error}->{code} = int( $ref->{error}->{code} ) if( $ref->{error}->{code} =~ /^\d+$/ );

        # We try hard to get the value for the property 'message', but if $locale is undefined, it is impossible to find out the language that was used to formulate the response.
        # So, ultimately, if we cannot find any value for the property 'message', we revert to guessing the HTTP caller's preferred language, which may, or may not be aligned with the content of other parts of the JSON response. Given that, in that s...
        if( !exists( $ref->{error}->{message} ) ||
            !defined( $ref->{error}->{message} ) ||
            !length( $ref->{error}->{message} // '' ) )
        {
            if( defined( $msg ) &&
                ( !ref( $msg ) || $self->_can_overload( $msg => "''" ) ) )
            {
                $ref->{error}->{message} = "$msg";
            }

lib/Apache2/API/Status.pm  view on Meta::CPAN

See also C<308 Permanent Redirect>

=head2 HTTP_MOVED_TEMPORARILY (302)

See L<rfc 7231, section 6.4.3|https://tools.ietf.org/html/rfc7231#section-6.4.3>

This is returned to indicate the resource was found, but somewhere else. This is to be understood as a temporary change.

The de facto standard, divergent from the original intent, is to point the client to a new location after a C<POST> request was performed. This is why the status code C<307> was created.

See also C<307 Temporary Redirect>, which more formally tells the client to reformulate their request to the new location.

See also C<303 See Other> for a formal implementation of aforementioned de facto standard, i.e. C<GET> new location after C<POST> request.

=head2 HTTP_SEE_OTHER (303)

See L<rfc 7231, section 6.4.4|https://tools.ietf.org/html/rfc7231#section-6.4.4>

This is returned to indicate the result of processing the request can be found at another location. For example, after a C<POST> request, such as:

    HTTP/1.1 303 See Other



( run in 2.069 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )