From: Evan Prodromou Date: Mon, 19 Mar 2012 05:59:26 +0000 (-0400) Subject: better propagation of HTTP response X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6a49e2632118203fbd8526ea626bf6e2c4b3bc3c;p=quix0rs-gnu-social.git better propagation of HTTP response --- diff --git a/spamfilter.php b/spamfilter.php index 47246b35c5..3ddfdad039 100644 --- a/spamfilter.php +++ b/spamfilter.php @@ -78,10 +78,6 @@ class SpamFilter extends OAuthClient { $response = $this->postJSON($this->server . "/is-this-spam", $activity->asArray()); - if (!$response->isOK()) { - throw new Exception("Error " . $response->getStatus() . " checking spam score: " . $response->getBody()); - } - $result = json_decode($response->getBody()); return $result; @@ -109,10 +105,6 @@ class SpamFilter extends OAuthClient { $response = $this->postJSON($this->server . $endpoint, $activity->asArray()); - if (!$response->isOK()) { - throw new Exception("Error " . $response->getStatus() . " checking spam score: " . $response->getBody()); - } - // We don't do much with the results return true; } @@ -168,10 +160,10 @@ class SpamFilter extends OAuthClient { try { $response = $hclient->send(); $code = $response->getStatus(); - if ($code < 200 || $code >= 400) { + if (!$response->isOK()) { throw new OAuthClientException($response->getBody(), $code); } - return $response->getBody(); + return $response; } catch (Exception $e) { throw new OAuthClientException($e->getMessage(), $e->getCode()); }