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 6d8de00 commit 4a09fa9
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

## 2.1.1

### Changed
Expand Down
5 changes: 4 additions & 1 deletion src/Input/BatchExecuteStatementRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ public function getTransactionId(): ?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/BeginTransactionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ public function getSecretArn(): ?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/CommitTransactionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ public function getTransactionId(): ?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/ExecuteStatementRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ public function getTransactionId(): ?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/RollbackTransactionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ public function getTransactionId(): ?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/BatchExecuteStatementRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_BatchExecuteStatement.html
$expected = '
POST /BatchExecute HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"database": "my_database",
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/BeginTransactionRequestTest.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/rdsdataservice/latest/APIReference/API_BeginTransaction.html
$expected = '
POST /BeginTransaction HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"database": "my_database",
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/CommitTransactionRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_CommitTransaction.html
$expected = '
POST /CommitTransaction HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"resourceArn": "arn:resource",
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/ExecuteStatementRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_ExecuteStatement.html
$expected = '
POST /Execute HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"continueAfterTimeout": false,
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/RollbackTransactionRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function testRequest(): void
// see https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_RollbackTransaction.html
$expected = '
POST /RollbackTransaction HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
{
"resourceArn": "arn:resource",
Expand Down

0 comments on commit 4a09fa9

Please sign in to comment.