From 30a3bbd4a78d52f1e5c9879eb4faf4df720b2bf9 Mon Sep 17 00:00:00 2001 From: aymm Date: Thu, 11 Mar 2021 16:27:25 +0000 Subject: [PATCH] Another redirect test --- src/APnutI.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/APnutI.php b/src/APnutI.php index 7d4ecf5..3a2a1d8 100644 --- a/src/APnutI.php +++ b/src/APnutI.php @@ -229,12 +229,13 @@ class APnutI throw new \Exception('SSL verification failed, connection terminated: ' . $url); } } - if ($http_status == 302) { - #echo json_encode(preg_match_all('/^Location:(.*)$/mi', $response, $matches)); - throw new HttpPnutRedirectException($response); - } if (!empty($response)) { $response = $this->parseHeaders($response); + if ($http_status == 302) { + #echo json_encode(preg_match_all('/^Location:(.*)$/mi', $response, $matches)); + $this->logger->debug("302 Redirect to {$this->redirect_target}"); + throw new HttpPnutRedirectException($this->redirect_targe); + } if (!empty($response)) { $response = json_decode($response, true); if ($response === null && !empty($this->redirect_target)) {