fix lwp http debug

This commit is contained in:
garnier-quentin 2019-07-01 17:49:57 +02:00
parent 747bc62381
commit d911a4b7db
1 changed files with 3 additions and 2 deletions

View File

@ -41,6 +41,7 @@ sub new {
$self->{output} = $options{output}; $self->{output} = $options{output};
$self->{ua} = undef; $self->{ua} = undef;
$self->{debug_handlers} = 0;
return $self; return $self;
} }
@ -125,7 +126,8 @@ sub request {
} }
} }
if ($self->{output}->is_debug()) { if ($self->{output}->is_debug() && $self->{debug_handlers} == 0) {
$self->{debug_handlers} = 1;
$self->{ua}->add_handler("request_send", sub { $self->{ua}->add_handler("request_send", sub {
my ($response, $ua, $handler) = @_; my ($response, $ua, $handler) = @_;
@ -245,7 +247,6 @@ sub request {
$self->{response}->www_authenticate =~ /(\S+)/); $self->{response}->www_authenticate =~ /(\S+)/);
} }
$self->{output}->output_add(long_msg => $self->{response}->content, debug => 1);
$self->{output}->output_add(severity => $status, $self->{output}->output_add(severity => $status,
short_msg => $short_msg); short_msg => $short_msg);
$self->{output}->display(); $self->{output}->display();