Skip to content

Commit

Permalink
Add an accept header in JSON request to help 3rd party services like …
Browse files Browse the repository at this point in the history
…localstack (#1721)
  • Loading branch information
jderusse authored Jun 5, 2024
1 parent 9b09be5 commit 9960016
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## NOT RELEASED

### Changed

- Add `Accept: application/json` header in request to fix incompatibility with 3rd party providers

## 1.0.2

### Changed
Expand Down
5 changes: 4 additions & 1 deletion src/Input/CalculateRouteMatrixRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ public function getTruckModeOptions(): ?CalculateRouteTruckModeOptions
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/json'];
$headers = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
];

// Prepare query
$query = [];
Expand Down
5 changes: 4 additions & 1 deletion src/Input/CalculateRouteRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ public function getWaypointPositions(): array
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/json'];
$headers = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
];

// Prepare query
$query = [];
Expand Down
5 changes: 4 additions & 1 deletion src/Input/SearchPlaceIndexForPositionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ public function getPosition(): array
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/json'];
$headers = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
];

// Prepare query
$query = [];
Expand Down
5 changes: 4 additions & 1 deletion src/Input/SearchPlaceIndexForTextRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ public function getText(): ?string
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/json'];
$headers = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
];

// Prepare query
$query = [];
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/CalculateRouteMatrixRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/location/latest/APIReference/API_CalculateRouteMatrix.html
$expected = '
POST /routes/v0/calculators/CalculatorName/calculate/route-matrix HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"DepartNow": false,
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/CalculateRouteRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/location/latest/APIReference/API_CalculateRoute.html
$expected = '
POST /routes/v0/calculators/CalculatorName/calculate/route HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"DepartNow": false,
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/SearchPlaceIndexForPositionRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/location/latest/APIReference/API_SearchPlaceIndexForPosition.html
$expected = '
POST /places/v0/indexes/IndexName/search/position HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"Language": "en",
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/SearchPlaceIndexForTextRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/location/latest/APIReference/API_SearchPlaceIndexForText.html
$expected = '
POST /places/v0/indexes/IndexName/search/text HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"BiasPosition": [
Expand Down

0 comments on commit 9960016

Please sign in to comment.