From bcf6d918b9cdb527923ec5b1646f78b4df955b90 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 21 Jul 2024 23:27:16 +0200 Subject: [PATCH] JSON::RPC::Legacy::Client: Do not try to parse non-existing JSON --- lib/JSON/RPC/Legacy/Client.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/JSON/RPC/Legacy/Client.pm b/lib/JSON/RPC/Legacy/Client.pm index b389c81..404a3f2 100644 --- a/lib/JSON/RPC/Legacy/Client.pm +++ b/lib/JSON/RPC/Legacy/Client.pm @@ -107,6 +107,9 @@ sub call { $self->status_line($result->status_line); + # If the server returned an error, we have no JSON. + return if ($result->code >= 500 && $result->code < 600); + return unless($result->content); # notification? if ($service) {