diff --git a/CHANGELOG.md b/CHANGELOG.md index 942539a..c50d9f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## NOT RELEASED +### Changed + +- Add `Accept: application/json` header in request to fix incompatibility with 3rd party providers + ## 1.1.1 ### Changed diff --git a/src/Input/GetThingShadowRequest.php b/src/Input/GetThingShadowRequest.php index 3e8a59f..d0f2871 100644 --- a/src/Input/GetThingShadowRequest.php +++ b/src/Input/GetThingShadowRequest.php @@ -70,7 +70,10 @@ public function getThingName(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/json']; + $headers = [ + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', + ]; // Prepare query $query = []; diff --git a/src/Input/UpdateThingShadowRequest.php b/src/Input/UpdateThingShadowRequest.php index 4ed7bfb..1886bfe 100644 --- a/src/Input/UpdateThingShadowRequest.php +++ b/src/Input/UpdateThingShadowRequest.php @@ -87,7 +87,10 @@ public function getThingName(): ?string public function request(): Request { // Prepare headers - $headers = ['content-type' => 'application/json']; + $headers = [ + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', + ]; // Prepare query $query = []; diff --git a/tests/Unit/Input/GetThingShadowRequestTest.php b/tests/Unit/Input/GetThingShadowRequestTest.php index 1620918..aa93c99 100644 --- a/tests/Unit/Input/GetThingShadowRequestTest.php +++ b/tests/Unit/Input/GetThingShadowRequestTest.php @@ -17,7 +17,8 @@ public function testRequest(): void // see https://docs.aws.amazon.com/iot/latest/apireference/API_Operations_AWS_IoT_Data_Plane.html/API_GetThingShadow.html $expected = ' GET /things/unit21_hvac/shadow?name=temperature HTTP/1.0 - Content-Type: application/json + Content-type: application/json + Accept: application/json '; self::assertRequestEqualsHttpRequest($expected, $input->request()); diff --git a/tests/Unit/Input/UpdateThingShadowRequestTest.php b/tests/Unit/Input/UpdateThingShadowRequestTest.php index a9e3c65..2ae2746 100644 --- a/tests/Unit/Input/UpdateThingShadowRequestTest.php +++ b/tests/Unit/Input/UpdateThingShadowRequestTest.php @@ -18,7 +18,8 @@ public function testRequest(): void // see https://docs.aws.amazon.com/iot/latest/apireference/API_Operations_AWS_IoT_Data_Plane.html/API_UpdateThingShadow.html $expected = ' POST /things/unit21_hvac/shadow?name=temperature HTTP/1.0 - Content-Type: application/json + Content-type: application/json + Accept: application/json { "state": {