Skip to content

Commit f2297f7

Browse files
authored
Add an accept header in JSON request to help 3rd party services like localstack (#1721)
1 parent e965942 commit f2297f7

35 files changed

+48
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Changed
66

7+
- Add `Accept: application/json` header in request to fix incompatibility with 3rd party providers
78
- AWS enhancement: Documentation updates.
89

910
## 3.2.0

src/Input/BatchGetItemInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public function request(): Request
135135
$headers = [
136136
'Content-Type' => 'application/x-amz-json-1.0',
137137
'X-Amz-Target' => 'DynamoDB_20120810.BatchGetItem',
138+
'Accept' => 'application/json',
138139
];
139140

140141
// Prepare query

src/Input/BatchWriteItemInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public function request(): Request
125125
$headers = [
126126
'Content-Type' => 'application/x-amz-json-1.0',
127127
'X-Amz-Target' => 'DynamoDB_20120810.BatchWriteItem',
128+
'Accept' => 'application/json',
128129
];
129130

130131
// Prepare query

src/Input/CreateTableInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ public function request(): Request
407407
$headers = [
408408
'Content-Type' => 'application/x-amz-json-1.0',
409409
'X-Amz-Target' => 'DynamoDB_20120810.CreateTable',
410+
'Accept' => 'application/json',
410411
];
411412

412413
// Prepare query

src/Input/DeleteItemInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ public function request(): Request
347347
$headers = [
348348
'Content-Type' => 'application/x-amz-json-1.0',
349349
'X-Amz-Target' => 'DynamoDB_20120810.DeleteItem',
350+
'Accept' => 'application/json',
350351
];
351352

352353
// Prepare query

src/Input/DeleteTableInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function request(): Request
5858
$headers = [
5959
'Content-Type' => 'application/x-amz-json-1.0',
6060
'X-Amz-Target' => 'DynamoDB_20120810.DeleteTable',
61+
'Accept' => 'application/json',
6162
];
6263

6364
// Prepare query

src/Input/DescribeEndpointsRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function request(): Request
3737
$headers = [
3838
'Content-Type' => 'application/x-amz-json-1.0',
3939
'X-Amz-Target' => 'DynamoDB_20120810.DescribeEndpoints',
40+
'Accept' => 'application/json',
4041
];
4142

4243
// Prepare query

src/Input/DescribeTableInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function request(): Request
5959
$headers = [
6060
'Content-Type' => 'application/x-amz-json-1.0',
6161
'X-Amz-Target' => 'DynamoDB_20120810.DescribeTable',
62+
'Accept' => 'application/json',
6263
];
6364

6465
// Prepare query

src/Input/ExecuteStatementInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public function request(): Request
165165
$headers = [
166166
'Content-Type' => 'application/x-amz-json-1.0',
167167
'X-Amz-Target' => 'DynamoDB_20120810.ExecuteStatement',
168+
'Accept' => 'application/json',
168169
];
169170

170171
// Prepare query

src/Input/GetItemInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ public function request(): Request
214214
$headers = [
215215
'Content-Type' => 'application/x-amz-json-1.0',
216216
'X-Amz-Target' => 'DynamoDB_20120810.GetItem',
217+
'Accept' => 'application/json',
217218
];
218219

219220
// Prepare query

src/Input/ListTablesInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function request(): Request
7171
$headers = [
7272
'Content-Type' => 'application/x-amz-json-1.0',
7373
'X-Amz-Target' => 'DynamoDB_20120810.ListTables',
74+
'Accept' => 'application/json',
7475
];
7576

7677
// Prepare query

src/Input/PutItemInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ public function request(): Request
362362
$headers = [
363363
'Content-Type' => 'application/x-amz-json-1.0',
364364
'X-Amz-Target' => 'DynamoDB_20120810.PutItem',
365+
'Accept' => 'application/json',
365366
];
366367

367368
// Prepare query

src/Input/QueryInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ public function request(): Request
536536
$headers = [
537537
'Content-Type' => 'application/x-amz-json-1.0',
538538
'X-Amz-Target' => 'DynamoDB_20120810.Query',
539+
'Accept' => 'application/json',
539540
];
540541

541542
// Prepare query

src/Input/ScanInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ public function request(): Request
476476
$headers = [
477477
'Content-Type' => 'application/x-amz-json-1.0',
478478
'X-Amz-Target' => 'DynamoDB_20120810.Scan',
479+
'Accept' => 'application/json',
479480
];
480481

481482
// Prepare query

src/Input/TransactWriteItemsInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ public function request(): Request
132132
$headers = [
133133
'Content-Type' => 'application/x-amz-json-1.0',
134134
'X-Amz-Target' => 'DynamoDB_20120810.TransactWriteItems',
135+
'Accept' => 'application/json',
135136
];
136137

137138
// Prepare query

src/Input/UpdateItemInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ public function request(): Request
453453
$headers = [
454454
'Content-Type' => 'application/x-amz-json-1.0',
455455
'X-Amz-Target' => 'DynamoDB_20120810.UpdateItem',
456+
'Accept' => 'application/json',
456457
];
457458

458459
// Prepare query

src/Input/UpdateTableInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public function request(): Request
262262
$headers = [
263263
'Content-Type' => 'application/x-amz-json-1.0',
264264
'X-Amz-Target' => 'DynamoDB_20120810.UpdateTable',
265+
'Accept' => 'application/json',
265266
];
266267

267268
// Prepare query

src/Input/UpdateTimeToLiveInput.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public function request(): Request
7777
$headers = [
7878
'Content-Type' => 'application/x-amz-json-1.0',
7979
'X-Amz-Target' => 'DynamoDB_20120810.UpdateTimeToLive',
80+
'Accept' => 'application/json',
8081
];
8182

8283
// Prepare query

tests/Unit/Input/BatchGetItemInputTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function testRequest(): void
4242
POST / HTTP/1.0
4343
Content-Type: application/x-amz-json-1.0
4444
x-amz-target: DynamoDB_20120810.BatchGetItem
45+
Accept: application/json
4546
4647
{
4748
"RequestItems": {

tests/Unit/Input/BatchWriteItemInputTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function testRequest(): void
5151
POST / HTTP/1.0
5252
Content-Type: application/x-amz-json-1.0
5353
X-Amz-Target: DynamoDB_20120810.BatchWriteItem
54+
Accept: application/json
5455
5556
{
5657
"RequestItems": {

tests/Unit/Input/CreateTableInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public function testRequest(): void
5050
$expected = '
5151
POST / HTTP/1.0
5252
Content-Type: application/x-amz-json-1.0
53-
X-AMZ-Target: DynamoDB_20120810.CreateTable
53+
x-amz-target: DynamoDB_20120810.CreateTable
54+
Accept: application/json
5455
5556
{
5657
"AttributeDefinitions": [

tests/Unit/Input/DeleteItemInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public function testRequest(): void
2323
$expected = '
2424
POST / HTTP/1.0
2525
Content-Type: application/x-amz-json-1.0
26-
X-AMZ-Target: DynamoDB_20120810.DeleteItem
26+
x-amz-target: DynamoDB_20120810.DeleteItem
27+
Accept: application/json
2728
2829
{
2930
"Key": {

tests/Unit/Input/DeleteTableInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public function testRequest(): void
1717
$expected = '
1818
POST / HTTP/1.0
1919
Content-Type: application/x-amz-json-1.0
20-
X-AMZ-Target: DynamoDB_20120810.DeleteTable
20+
x-amz-target: DynamoDB_20120810.DeleteTable
21+
Accept: application/json
2122
2223
{
2324
"TableName": "Music"

tests/Unit/Input/DescribeEndpointsRequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function testRequest(): void
1717
POST / HTTP/1.0
1818
Content-Type: application/x-amz-json-1.0
1919
x-amz-target: DynamoDB_20120810.DescribeEndpoints
20+
Accept: application/json
2021
2122
{
2223
}

tests/Unit/Input/DescribeTableInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public function testRequest(): void
1717
$expected = '
1818
POST / HTTP/1.0
1919
Content-Type: application/x-amz-json-1.0
20-
X-AMZ-Target: DynamoDB_20120810.DescribeTable
20+
x-amz-target: DynamoDB_20120810.DescribeTable
21+
Accept: application/json
2122
2223
{
2324
"TableName": "Music"

tests/Unit/Input/ExecuteStatementInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public function testRequest(): void
2323
$expected = '
2424
POST / HTTP/1.0
2525
Content-Type: application/x-amz-json-1.0
26-
X-AMZ-Target: DynamoDB_20120810.ExecuteStatement
26+
x-amz-target: DynamoDB_20120810.ExecuteStatement
27+
Accept: application/json
2728
2829
{
2930
"Statement": "SELECT * FROM \"Music\" WHERE SongTitle = ?",

tests/Unit/Input/GetItemInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public function testRequest(): void
2424
$expected = '
2525
POST / HTTP/1.0
2626
Content-Type: application/x-amz-json-1.0
27-
X-AMZ-Target: DynamoDB_20120810.GetItem
27+
x-amz-target: DynamoDB_20120810.GetItem
28+
Accept: application/json
2829
2930
{
3031
"TableName": "Music",

tests/Unit/Input/ListTablesInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public function testRequest(): void
1818
$expected = '
1919
POST / HTTP/1.0
2020
Content-Type: application/x-amz-json-1.0
21-
X-AMZ-Target: DynamoDB_20120810.ListTables
21+
x-amz-target: DynamoDB_20120810.ListTables
22+
Accept: application/json
2223
2324
{
2425
"ExclusiveStartTableName": "Forum",

tests/Unit/Input/PutItemInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public function testRequest(): void
2929
$expected = '
3030
POST / HTTP/1.0
3131
Content-Type: application/x-amz-json-1.0
32-
X-AMZ-Target: DynamoDB_20120810.PutItem
32+
x-amz-target: DynamoDB_20120810.PutItem
33+
Accept: application/json
3334
3435
{
3536
"TableName": "Thread",

tests/Unit/Input/QueryInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public function testRequest(): void
2828
$expected = '
2929
POST / HTTP/1.0
3030
Content-Type: application/x-amz-json-1.0
31-
X-AMZ-Target: DynamoDB_20120810.Query
31+
x-amz-target: DynamoDB_20120810.Query
32+
Accept: application/json
3233
3334
{
3435
"TableName": "Reply",

tests/Unit/Input/ScanInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public function testRequest(): void
2020
$expected = '
2121
POST / HTTP/1.0
2222
Content-Type: application/x-amz-json-1.0
23-
X-AMZ-Target: DynamoDB_20120810.Scan
23+
x-amz-target: DynamoDB_20120810.Scan
24+
Accept: application/json
2425
2526
{
2627
"TableName": "Reply",

tests/Unit/Input/TransactWriteItemsInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public function testRequest(): void
3737
$expected = '
3838
POST / HTTP/1.0
3939
Content-Type: application/x-amz-json-1.0
40-
X-AMZ-Target: DynamoDB_20120810.TransactWriteItems
40+
x-amz-target: DynamoDB_20120810.TransactWriteItems
41+
Accept: application/json
4142
4243
{
4344
"TransactItems": [

tests/Unit/Input/UpdateItemInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public function testRequest(): void
2828
$expected = '
2929
POST / HTTP/1.0
3030
Content-Type: application/x-amz-json-1.0
31-
X-AMZ-Target: DynamoDB_20120810.UpdateItem
31+
x-amz-target: DynamoDB_20120810.UpdateItem
32+
Accept: application/json
3233
3334
{
3435
"TableName": "Thread",

tests/Unit/Input/UpdateTableInputTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public function testRequest(): void
2222
$expected = '
2323
POST / HTTP/1.0
2424
Content-Type: application/x-amz-json-1.0
25-
X-AMZ-Target: DynamoDB_20120810.UpdateTable
25+
x-amz-target: DynamoDB_20120810.UpdateTable
26+
Accept: application/json
2627
2728
{
2829
"TableName": "Thread",

tests/Unit/Input/UpdateTimeToLiveInputTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function testRequest(): void
2323
POST / HTTP/1.0
2424
Content-Type: application/x-amz-json-1.0
2525
X-Amz-Target: DynamoDB_20120810.UpdateTimeToLive
26+
Accept: application/json
2627
2728
{
2829
"TableName": "table name",

0 commit comments

Comments
 (0)