Skip to content

Commit

Permalink
fix: adding suport to amazon JSON content type in the getToken request
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusDev20 committed Nov 18, 2024
1 parent 40bdc43 commit a892610
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios, { AxiosError, AxiosInstance } from 'axios';

import { ContentTypes } from './enums';
import { ContentTypes, jsonContentTypes } from './enums';
import { ZendeskRequestError } from './exceptions';
import { AuthBasic } from './interfaces';
import { AuthOptions, AuthOptionsZendesk } from './types';
Expand Down Expand Up @@ -124,7 +124,7 @@ export class BearerAuthZendesk extends BaseBearerAuth implements AuthBasic {
httpCompleteResponse: true,
contentType: contentType || ContentTypes.X_URL_ENCODED,
data:
contentType === ContentTypes.JSON
jsonContentTypes.includes(contentType)
? JSON.stringify(this.authOptions.bearer.data)
: this.authOptions.bearer.data,
headers: this.authOptions.bearer.headers || {},
Expand Down
2 changes: 2 additions & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ export enum ContentTypes {
JSON = 'application/json',
X_URL_ENCODED = 'application/x-www-form-urlencoded'
}

export const jsonContentTypes = ['application/json', 'application/x-amz-json-1.1'];

0 comments on commit a892610

Please sign in to comment.