diff --git a/src/Client/BasicAuthClient.php b/src/Client/BasicAuthClient.php index f778486..371cea5 100644 --- a/src/Client/BasicAuthClient.php +++ b/src/Client/BasicAuthClient.php @@ -282,7 +282,7 @@ private function decodeHeaders(string $headers) : array $headerKey = trim(substr($header, 0, $separator)); $headerKey = implode('-', array_map('ucfirst', explode('-', $headerKey))); - $headerArray[$headerKey] = trim(substr($header, $separator + 1)); + $headerArray[strtolower($headerKey)] = trim(substr($header, $separator + 1)); } return $headerArray; diff --git a/src/Client/BookboonResponse.php b/src/Client/BookboonResponse.php index 0301fa9..d0367e7 100644 --- a/src/Client/BookboonResponse.php +++ b/src/Client/BookboonResponse.php @@ -58,7 +58,7 @@ public function getHeaders() : array public function getReturnArray() : array { if ($this->getStatus() >= 300) { - return ['url' => $this->getHeaders()['Location']]; + return ['url' => $this->getHeaders()['location']]; } $json = json_decode($this->body, true); diff --git a/src/Client/OauthClient.php b/src/Client/OauthClient.php index 31b2045..ee9464a 100644 --- a/src/Client/OauthClient.php +++ b/src/Client/OauthClient.php @@ -298,7 +298,7 @@ protected function normalizeHeaders(array $headers) : array { $returnHeaders = []; foreach ($headers as $key => $header) { - $returnHeaders[$key] = $header[0] ?? $header; + $returnHeaders[strtolower($key)] = $header[0] ?? $header; } return $returnHeaders; diff --git a/tests/Client/BasicAuthClientTest.php b/tests/Client/BasicAuthClientTest.php index 2479022..2527d37 100644 --- a/tests/Client/BasicAuthClientTest.php +++ b/tests/Client/BasicAuthClientTest.php @@ -42,7 +42,7 @@ public function testBadAuthentication() public function testNonExistingHeader() { $headers = "HTTP/1.1 200 OK\n Content-Type: application/json; charset=utf-8\nServer: Microsoft-IIS/8.0"; - $result = \Helpers::invokeMethod(self::$client, 'getResponseHeader', [[$headers], 'Location']); + $result = \Helpers::invokeMethod(self::$client, 'getResponseHeader', [[$headers], 'location']); $this->assertEmpty($result); } @@ -51,7 +51,7 @@ public function testValidHeader() { $headers = "HTTP/1.1 200 OK\n Content-Type: application/json; charset=utf-8\nServer: Microsoft-IIS/8.0\nLocation: http://bookboon.com"; $headerArray = \Helpers::invokeMethod(self::$client, 'decodeHeaders', [$headers]); - $result = $headerArray['Location']; + $result = $headerArray['location']; $this->assertEquals('http://bookboon.com', $result); } @@ -81,4 +81,4 @@ public function testNotSupportedMethods($method) } self::$client->$method($param, "b"); } -} \ No newline at end of file +} diff --git a/tests/Client/BookboonResponseTest.php b/tests/Client/BookboonResponseTest.php index ca3395d..8a5d0aa 100644 --- a/tests/Client/BookboonResponseTest.php +++ b/tests/Client/BookboonResponseTest.php @@ -13,7 +13,7 @@ class BookboonResponseTest extends TestCase { public function testRedirectResponse() { $testUrl = 'http://test.com'; - $bResponse = new BookboonResponse('', 302, ['Location' => $testUrl]); + $bResponse = new BookboonResponse('', 302, ['location' => $testUrl]); $this->assertEquals(['url' => $testUrl], $bResponse->getReturnArray()); } diff --git a/tests/Entity/JourneyTest.php b/tests/Entity/JourneyTest.php index b68979b..6a25589 100644 --- a/tests/Entity/JourneyTest.php +++ b/tests/Entity/JourneyTest.php @@ -45,7 +45,7 @@ public function testFirstAllJourneysData() public function testGetJourney() { - $data = Journey::get(self::$bookboon, '010e0268-0eec-4859-a67a-ce41ee2315c4') + $data = Journey::get(self::$bookboon, '40b8b453-4ce9-425b-baa9-a8d88a589e3d') ->getEntityStore() ->get()[0];