From c8072eda9bbf21b84bbbe1b54f6a10a9d8414ae4 Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Thu, 27 Feb 2020 21:25:54 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Don't=20parse=20body=20if=20rate?= =?UTF-8?q?=20limited=20reached?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #48 --- src/Pinterest/Http/Response.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pinterest/Http/Response.php b/src/Pinterest/Http/Response.php index e4bfc2c..2ef630c 100644 --- a/src/Pinterest/Http/Response.php +++ b/src/Pinterest/Http/Response.php @@ -80,7 +80,7 @@ public function __construct(Request $request, $statusCode, $rawBody, array $head $this->request = $request; $this->statusCode = (int) $statusCode; $this->rawBody = (string) $rawBody; - $this->body = $this->parseJson($this->rawBody); + $this->body = $this->statusCode >= 200 && $this->statusCode < 300 ? $this->parseJson($this->rawBody) : null; $this->headers = $headers; }