Catmandu-Resolver

 view release on metacpan or  search on metacpan

lib/Catmandu/Store/Resolver/API.pm  view on Meta::CPAN


    my $response = $self->ua->get($req_url);

    if ($response->is_success) {
        # New API
        return decode_json($response->decoded_content);
    } else {
        # If it is 404, it could be that the "new" api works,
        # but that the entity doesn't exist. So we check for
        # the presence of the error "Entity not found"
        # Also, the new API returns the application/json content-type
        # while the old doesn't.
        if ($response->code == 404) {
            if ($response->content_type eq 'application/json') {
                return {
                    'data' => {}
                };
            }
        }

        # Try with the old API



( run in 1.272 second using v1.01-cache-2.11-cpan-524268b4103 )