Skip to content

Commit 4fc5a99

Browse files
ignore uninitialized warnings here (RT#105787)
1 parent 8825fb5 commit 4fc5a99

4 files changed

Lines changed: 29 additions & 0 deletions

File tree

Changes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Revision history for HTTP-Message
22

3+
4+
- Resolve new uninitialized warning from
5+
HTTP::Request::Common::request_type_with_data (RT#105787)
6+
7+
38
6.07 2015-07-09
49

510
- Allow subclasses to override the class of parts - it used to be

MANIFEST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ t/message-old.t
2626
t/message-parts.t
2727
t/message.t
2828
t/request.t
29+
t/request_type_with_data.t
2930
t/response.t
3031
t/status-old.t
3132
t/status.t

lib/HTTP/Request/Common.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ sub form_data # RFC1867
138138
while (my ($k,$v) = splice(@data, 0, 2)) {
139139
if (!ref($v)) {
140140
$k =~ s/([\\\"])/\\$1/g; # escape quotes and backslashes
141+
no warnings 'uninitialized';
141142
push(@parts,
142143
qq(Content-Disposition: form-data; name="$k"$CRLF$CRLF$v));
143144
}

t/request_type_with_data.t

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More 0.88;
5+
use HTTP::Request::Common;
6+
7+
# I'd use Test::Warnings here, but let's respect our downstream consumers and
8+
# not force that prereq on them
9+
my @warnings;
10+
$SIG{__WARN__} = sub { push @warnings, grep { length } @_ };
11+
12+
my $request = HTTP::Request::Common::request_type_with_data(
13+
'POST' => 'https://localhost/',
14+
'content_type' => 'multipart/form-data; boundary=----1234',
15+
'content' => [ a => 1, b => undef ],
16+
);
17+
18+
isa_ok($request, 'HTTP::Request');
19+
is(scalar(@warnings), 0, 'no warnings')
20+
or diag('got warnings: ', explain(\@warnings));
21+
22+
done_testing;

0 commit comments

Comments
 (0)