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 93d2492 commit 3170338
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 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/GetRoleCredentialsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ public function getRoleName(): ?string
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/json'];
$headers = [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
];
if (null === $v = $this->accessToken) {
throw new InvalidArgument(sprintf('Missing parameter "accessToken" for "%s". The value cannot be null.', __CLASS__));
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Input/GetRoleCredentialsRequestTest.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/singlesignon/latest/PortalAPIReference/API_GetRoleCredentials.html
$expected = '
GET /federation/credentials?role_name=RoleName&account_id=AccountId HTTP/1.0
Content-Type: application/json
Content-type: application/json
Accept: application/json
x-amz-sso_bearer_token: AccessToken
';

Expand Down

0 comments on commit 3170338

Please sign in to comment.