Skip to content

Commit b51d993

Browse files
committed
lwp-dump --request option to dump the request as well
1 parent bd65c81 commit b51d993

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

bin/lwp-dump

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ GetOptions(\my %opt,
1414
'keep-client-headers',
1515
'method=s',
1616
'agent=s',
17+
'request',
1718
) || usage();
1819

1920
my $url = shift || usage();
@@ -30,6 +31,7 @@ Recognized options are:
3031
--max-length <n>
3132
--method <str>
3233
--parse-head
34+
--request
3335
3436
EOT
3537
}
@@ -47,6 +49,11 @@ $res->remove_header(grep /^Client-/, $res->header_field_names)
4749
unless $opt{'keep-client-headers'} or
4850
($res->header("Client-Warning") || "") eq "Internal response";
4951

52+
if ($opt{request}) {
53+
$res->request->dump;
54+
print "\n";
55+
}
56+
5057
$res->dump(maxlength => $opt{'max-length'});
5158

5259
__END__
@@ -101,6 +108,10 @@ By default B<lwp-dump> will not try to initialize headers by looking at the
101108
head section of HTML documents. This option enables this. This corresponds to
102109
L<LWP::UserAgent/"parse_head">.
103110
111+
=item B<--request>
112+
113+
Also dump the request sent.
114+
104115
=back
105116
106117
=head1 SEE ALSO

0 commit comments

Comments
 (0)