Skip to content

Commit 3170338

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

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Changed
6+
7+
- Add `Accept: application/json` header in request to fix incompatibility with 3rd party providers
8+
59
## 1.2.0
610

711
### Added

src/Input/GetRoleCredentialsRequest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ public function getRoleName(): ?string
8989
public function request(): Request
9090
{
9191
// Prepare headers
92-
$headers = ['content-type' => 'application/json'];
92+
$headers = [
93+
'Content-Type' => 'application/json',
94+
'Accept' => 'application/json',
95+
];
9396
if (null === $v = $this->accessToken) {
9497
throw new InvalidArgument(sprintf('Missing parameter "accessToken" for "%s". The value cannot be null.', __CLASS__));
9598
}

tests/Unit/Input/GetRoleCredentialsRequestTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public function testRequest(): void
1818
// see https://docs.aws.amazon.com/singlesignon/latest/PortalAPIReference/API_GetRoleCredentials.html
1919
$expected = '
2020
GET /federation/credentials?role_name=RoleName&account_id=AccountId HTTP/1.0
21-
Content-Type: application/json
21+
Content-type: application/json
22+
Accept: application/json
2223
x-amz-sso_bearer_token: AccessToken
2324
';
2425

0 commit comments

Comments
 (0)