| 1 | package Paws::Net::Caller; | ||||||||||
| 2 | 13 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 13 | with 'Paws::Net::RetryCallerRole', 'Paws::Net::CallerRole'; | |||||||||
| 4 | 13 | ▶ | use Paws::Net::APIResponse; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 61 | ▶ | has debug => ( is => 'rw', required => 0, default => sub { 0 } ); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 7 | has ua => (is => 'rw', required => 1, lazy => 1, | ||||||||||
| 8 | 2 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 13 | ▶ | use HTTP::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 2 | HTTP::Tiny->new( | |||||||||
| 11 | agent => 'AWS Perl SDK ' . $Paws::VERSION, | ||||||||||
| 12 | timeout => 60, | ||||||||||
| 13 | ); | ||||||||||
| 14 | } | ||||||||||
| 15 | 13 | ); | |||||||||
| 16 | |||||||||||
| 17 | 10 | ▶ | sub send_request { | ||||||||
|
Subroutine
send_request: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 18 | 10 | my ($self, $service, $call_object) = @_; | |||||||||
| 19 | 10 | my $requestObj = $service->prepare_request_for_call($call_object); | |||||||||
| 20 | 10 | my $headers = $requestObj->header_hash; | |||||||||
| 21 | |||||||||||
| 22 | # HTTP::Tiny derives the Host header from the URL. It's an error to set it. | ||||||||||
| 23 | 10 | delete $headers->{Host}; | |||||||||
| 24 | |||||||||||
| 25 | 10 | ▶ | my $response = $self->ua->request( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | $requestObj->method, | ||||||||||
| 27 | $requestObj->url, | ||||||||||
| 28 | { | ||||||||||
| 29 | headers => $headers, | ||||||||||
| 30 | (defined $requestObj->content)?(content => $requestObj->content):(), | ||||||||||
| 31 | } | ||||||||||
| 32 | ); | ||||||||||
| 33 | return Paws::Net::APIResponse->new( | ||||||||||
| 34 | status => $response->{status}, | ||||||||||
| 35 | content => $response->{content}, | ||||||||||
| 36 | headers => $response->{headers} | ||||||||||
| 37 | 10 | ); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 105 | ▶ | sub caller_to_response { | ||||||||
|
Subroutine
caller_to_response: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | 105 | my ($self, $service, $call_object, $response) = @_; | |||||||||
| 42 | |||||||||||
| 43 | 105 | ▶ | if ($response->status == 599){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 15 | return Paws::Exception->new(message => $response->content, code => 'ConnectionError', request_id => ''); | |||||||||
| 45 | } else { | ||||||||||
| 46 | 90 | return $service->response_to_object->process($call_object, $response); | |||||||||
| 47 | } | ||||||||||
| 48 | } | ||||||||||
| 49 | 13 | 1; | |||||||||