fix smartermail (#2296)
This commit is contained in:
parent
11537b200e
commit
6401ad7b64
|
@ -117,11 +117,11 @@ sub get_port {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub json_decode {
|
sub json_decode {
|
||||||
my ($self, $content) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $decoded;
|
my $decoded;
|
||||||
eval {
|
eval {
|
||||||
$decoded = JSON::XS->new->utf8->decode($content);
|
$decoded = JSON::XS->new->utf8->decode($options{content});
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
|
$self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
|
||||||
|
@ -188,7 +188,7 @@ sub get_auth_token {
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
my $decoded = $self->json_decode($content);
|
my $decoded = $self->json_decode(content => $content);
|
||||||
if (!defined($decoded->{accessToken})) {
|
if (!defined($decoded->{accessToken})) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Cannot get token");
|
$self->{output}->add_option_msg(short_msg => "Cannot get token");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
|
|
Loading…
Reference in New Issue