Skip to content

Commit

Permalink
fix(grant-token): add content-type header
Browse files Browse the repository at this point in the history
  • Loading branch information
parfeon committed May 20, 2024
1 parent e30f827 commit 28552a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/core/endpoints/access_manager/grant_token.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class GrantTokenRequest extends request_1.AbstractRequest {
get path() {
return `/v3/pam/${this.parameters.keySet.subscribeKey}/grant`;
}
get headers() {
return { 'Content-Type': 'application/json' };
}
get body() {
const { ttl, meta } = this.parameters;
const body = Object.assign({}, (ttl || ttl === 0 ? { ttl } : {}));
Expand Down
4 changes: 4 additions & 0 deletions src/core/endpoints/access_manager/grant_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export class GrantTokenRequest extends AbstractRequest<PAM.GrantTokenResponse> {
return `/v3/pam/${this.parameters.keySet.subscribeKey}/grant`;
}

protected get headers(): Record<string, string> | undefined {
return { 'Content-Type': 'application/json' };
}

protected get body(): string {
const { ttl, meta } = this.parameters;
const body: Record<string, unknown> = { ...(ttl || ttl === 0 ? { ttl } : {}) };
Expand Down

0 comments on commit 28552a5

Please sign in to comment.