feat: forceTokenTypeToCamelCase
This commit is contained in:
parent
b28840ad18
commit
2792b3e7b5
2 changed files with 6 additions and 1 deletions
|
@ -18,6 +18,7 @@ export interface LhispOauthClientConstructorParams {
|
|||
grantType?: string;
|
||||
authContentType?: ContentType;
|
||||
sendAuthCredentialsOnRequestBody?: boolean;
|
||||
forceTokenTypeToCamelCase?: boolean;
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
protected tokenCreatedAt = 0;
|
||||
protected tokenExpiresIn = 0;
|
||||
protected sendAuthCredentialsOnRequestBody?: boolean;
|
||||
protected forceTokenTypeToCamelCase?: boolean;
|
||||
|
||||
constructor(params: LhispOauthClientConstructorParams) {
|
||||
if (params.certificado) {
|
||||
|
@ -131,7 +132,10 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
}
|
||||
|
||||
getAuthToken() {
|
||||
return `${this.accessToken?.token_type} ${this.accessToken?.access_token}`;
|
||||
const tokenType = this.forceTokenTypeToCamelCase
|
||||
? `${this.accessToken?.token_type?.[0]?.toUpperCase()}${this.accessToken?.token_type?.substring(1)}`
|
||||
: this.accessToken?.token_type;
|
||||
return `${tokenType} ${this.accessToken?.access_token}`;
|
||||
}
|
||||
|
||||
async executarRequest<ResponseType>({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue