From 7264b523a61292c713d628d0335d10482749ad5f Mon Sep 17 00:00:00 2001 From: aymm Date: Thu, 11 Mar 2021 16:18:37 +0000 Subject: [PATCH] Fixed redirects --- src/APnutI.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/APnutI.php b/src/APnutI.php index 5906b64..bab5b52 100644 --- a/src/APnutI.php +++ b/src/APnutI.php @@ -158,7 +158,7 @@ class APnutI break; case 'location': case 'Location': - $this->redirectTarget = $v; + $this->redirect_target = $v; break; } } @@ -230,6 +230,9 @@ class APnutI $response = $this->parseHeaders($response); if (!empty($response)) { $response = json_decode($response, true); + if ($response === null && !empty($this->redirect_target)) { + throw new HttpPnutRedirectException($this->redirect_target); + } try { $this->meta = new Meta($response); } catch (NotAuthorizedException $nae) {