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 ac7bb96 commit 842e3b1
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 10 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.2.0

### Added
Expand Down
5 changes: 4 additions & 1 deletion src/Input/CancelJobRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ public function getId(): ?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
5 changes: 4 additions & 1 deletion src/Input/CreateJobRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ public function getUserMetadata(): 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/DescribeEndpointsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ public function getNextToken(): ?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
5 changes: 4 additions & 1 deletion src/Input/GetJobRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ public function getId(): ?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
5 changes: 4 additions & 1 deletion src/Input/ListJobsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ public function getStatus(): ?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/CancelJobRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/mediaconvert/latest/apireference/API_CancelJob.html
$expected = '
DELETE /2017-08-29/jobs/ZJ1648461 HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
';

Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/CreateJobRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/mediaconvert/latest/apireference/API_CreateJob.html
$expected = '
POST /2017-08-29/jobs HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"accelerationSettings": {
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/DescribeEndpointsRequestTest.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/mediaconvert/latest/apireference/API_DescribeEndpoints.html
$expected = '
POST /2017-08-29/endpoints HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"maxResults": 1337,
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/GetJobRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/mediaconvert/latest/apireference/API_GetJob.html
$expected = '
GET /2017-08-29/jobs/ZJ1648461 HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
';

Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/ListJobsRequestTest.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/mediaconvert/latest/apireference/API_ListJobs.html
$expected = '
GET /2017-08-29/jobs?maxResults=1337&nextToken=fakeToken&order=ASCENDING&queue=fakeQueue&status=COMPLETE HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
';

Expand Down

0 comments on commit 842e3b1

Please sign in to comment.