feat: adiciona flag disableAuthContentType
This commit is contained in:
parent
e100d9cb7b
commit
970ccff48e
3 changed files with 23 additions and 5 deletions
|
@ -21,6 +21,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
protected authHeaderName: string;
|
||||
protected tokenHeaderName: string;
|
||||
protected authContentType: ContentType;
|
||||
protected disableAuthContentType = false;
|
||||
protected certificado?: string;
|
||||
protected senhaCertificado?: string;
|
||||
protected authScope?: string;
|
||||
|
@ -53,6 +54,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
this.authScope = params.authScope;
|
||||
this.grantType = params.grantType || defaultGrantType;
|
||||
this.authContentType = params.authContentType || defaultAuthContentType;
|
||||
this.disableAuthContentType = Boolean(params.disableAuthContentType);
|
||||
this.clientId = params.clientId;
|
||||
this.clientSecret = params.clientSecret;
|
||||
this.authHeaderName = params.authHeaderName || defaultAuthHeaderName;
|
||||
|
@ -98,7 +100,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
httpsAgent: this.agent,
|
||||
headers: {
|
||||
[this.authHeaderName]: this.getAuthHeaderValue(),
|
||||
"Content-Type": this.authContentType,
|
||||
...(this.disableAuthContentType ? {} : { "Content-Type": this.authContentType }),
|
||||
},
|
||||
data: {},
|
||||
};
|
||||
|
@ -111,10 +113,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
if (this.clientSecret) authRequestOpt.data.client_secret = this.clientSecret;
|
||||
}
|
||||
|
||||
authRequestOpt.data = this.parseData({
|
||||
data: authRequestOpt.data,
|
||||
contentType: this.authContentType,
|
||||
});
|
||||
authRequestOpt.data = this.parseData({ data: authRequestOpt.data, contentType: this.authContentType });
|
||||
const resp = await axios.request(authRequestOpt);
|
||||
this.accessToken = this.buildAccessToken(resp.data);
|
||||
this.tokenCreatedAt = new Date().getTime();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue