From 82a37472d14977172cbd13912849f075921b5982 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 27 Jan 2011 12:26:58 -0600 Subject: [PATCH] fix --- lib/Lacuna/JRC.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Lacuna/JRC.pm b/lib/Lacuna/JRC.pm index 1f8fdf6b..d06d0d22 100644 --- a/lib/Lacuna/JRC.pm +++ b/lib/Lacuna/JRC.pm @@ -29,10 +29,10 @@ sub post { Content => to_json($content), Accept => 'application/json', ); - last if ($response->code < 400 && $response->code > 600); + last if ($response->header('Content-Type') eq 'application/json-rpc'); usleep((4 ** $retry) * 100_000); } - confess [$response->code, 'Could not connect to JSON RPC server.'] if ($response->code >= 400 && $response->code <= 600); + confess [$response->code, 'Could not connect to JSON RPC server.'] unless ($response->header('Content-Type') eq 'application/json-rpc'); my $result = from_json($response->content); if (exists $result->{error}) { confess [$result->{error}{code}, $result->{error}{message}, $result->{error}{data}]; -- 2.51.2