1 package HTTP
::AnyUA
::Backend
::Furl
;
2 # ABSTRACT: A unified programming interface for Furl
6 This module adds support for the HTTP client L<Furl> to be used with the unified programming
7 interface provided by L<HTTP::AnyUA>.
12 * L<Furl> doesn't keep a list of requests and responses along a redirect chain. As such, the C<url>
13 field in the response is always the same as the URL of the original request, and the C<redirects>
19 * L<HTTP::AnyUA::Backend>
26 our $VERSION = '9999.999'; # VERSION
28 use parent
'HTTP::AnyUA::Backend';
30 use HTTP
::AnyUA
::Util
;
35 my ($method, $url, $args) = @_;
37 local $args->{content
} = HTTP
::AnyUA
::Util
::coderef_content_to_string
($args->{content
});
39 my $request = HTTP
::AnyUA
::Util
::native_to_http_request
(@_);
40 my $ua_resp = $self->ua->request($request);
42 return $self->_munge_response($ua_resp, $args->{data_callback
});
51 success
=> !!$ua_resp->is_success,
52 url
=> $ua_resp->request->uri->as_string,
53 status
=> $ua_resp->code,
54 reason
=> $ua_resp->message,
55 headers
=> HTTP
::AnyUA
::Util
::http_headers_to_native
($ua_resp->headers),
58 $resp->{protocol
} = $ua_resp->protocol if $ua_resp->protocol;
60 if ($resp->{headers
}{'x-internal-response'}) {
61 HTTP
::AnyUA
::Util
::internal_exception
($ua_resp->content, $resp);
64 $data_cb->($ua_resp->content, $resp);
67 $resp->{content
} = $ua_resp->content;