| 1 | package Amazon::API::HTTP::UserAgent; | ||||||||||
| 2 | |||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 11 | ▶ | use HTTP::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 11 | ▶ | use Amazon::API::HTTP::Response; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | ######################################################################## | ||||||||||
| 10 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 11 | ######################################################################## | ||||||||||
| 12 | 1 | my ( $class, %opts ) = @_; | |||||||||
| 13 | |||||||||||
| 14 | 1 | return bless { ua => HTTP::Tiny->new(%opts) }, $class; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | ######################################################################## | ||||||||||
| 18 | 0 | ▶ | sub request { | ||||||||
|
Subroutine
request: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 19 | ######################################################################## | ||||||||||
| 20 | 0 | my ( $self, $request ) = @_; | |||||||||
| 21 | |||||||||||
| 22 | 0 | my %headers; | |||||||||
| 23 | |||||||||||
| 24 | $request->headers->scan( | ||||||||||
| 25 | 0 | ▶ | sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 26 | 0 | ▶ | if ( lc $_[0] ne 'host' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | $headers{ $_[0] } = $_[1]; | |||||||||
| 28 | } | ||||||||||
| 29 | } | ||||||||||
| 30 | 0 | ); | |||||||||
| 31 | |||||||||||
| 32 | 0 | my %opts = ( headers => \%headers ); | |||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | if ( my $content = $request->content ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | $opts{content} = $content; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 0 | my $response = $self->{ua}->request( $request->method, $request->uri->as_string, \%opts ); | |||||||||
| 39 | |||||||||||
| 40 | 0 | return Amazon::API::HTTP::Response->new($response); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 11 | 1; | |||||||||