dnsexit2: Check for JSON object, not just truthiness
This commit is contained in:
parent
4a394f4562
commit
1c94ed6063
1 changed files with 2 additions and 2 deletions
|
@ -4028,8 +4028,8 @@ sub dnsexit2_update_host {
|
|||
}
|
||||
(my $body = $reply) =~ s/^.*?\r?\n\r?\n//s;
|
||||
my $response = eval { decode_json($body); };
|
||||
if (!$response) {
|
||||
failed("$h: failed to parse response: $@");
|
||||
if (ref($response) ne 'HASH') {
|
||||
failed("$h: response is not a JSON object:\n$body");
|
||||
return;
|
||||
}
|
||||
if (!defined($response->{'code'}) || !defined($response->{'message'})) {
|
||||
|
|
Loading…
Reference in a new issue