line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::AnyUA::Middleware::ContentLength; |
2
|
|
|
|
|
|
|
# ABSTRACT: Middleware to add Content-Length header automatically |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
478
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
6
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.902'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use parent 'HTTP::AnyUA::Middleware'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
43
|
use HTTP::AnyUA::Util; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
132
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub request { |
16
|
3
|
|
|
3
|
1
|
8
|
my $self = shift; |
17
|
3
|
|
|
|
|
39
|
my ($method, $url, $args) = @_; |
18
|
|
|
|
|
|
|
|
19
|
3
|
|
|
|
|
14
|
$args->{headers} = HTTP::AnyUA::Util::normalize_headers($args->{headers}); |
20
|
|
|
|
|
|
|
|
21
|
3
|
100
|
66
|
|
|
21
|
if (!defined $args->{headers}{'content-length'} && $args->{content} && !ref $args->{content}) { |
|
|
|
100
|
|
|
|
|
22
|
1
|
|
|
|
|
3
|
$args->{headers}{'content-length'} = length $args->{content}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
10
|
return $self->backend->request($method, $url, $args); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |