diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index 213d8b4..4f60aef 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -1,6 +1,6 @@ import qs from "querystring"; import https from "https"; -import axios, { AxiosRequestConfig } from "axios"; +import axios, { AxiosHeaders, AxiosRequestConfig } from "axios"; import { AccessToken, ContentType, @@ -24,7 +24,7 @@ export class LhispOauthClient { protected certificado?: string | Buffer; protected senhaCertificado?: string; protected authScope?: string; - protected headers?: Headers; + protected headers?: AxiosHeaders; protected grantType?: string; protected agent: https.Agent; protected accessToken?: iAccessToken; @@ -47,7 +47,7 @@ export class LhispOauthClient { } this.certificado = params.certificado; - this.headers = (params.headers ? params.headers : {}) as any as Headers; + this.headers = (params.headers ? params.headers : {}) as any as AxiosHeaders; this.apiUrl = params.apiUrl; this.authUrl = params.authUrl; this.authScope = params.authScope; @@ -144,9 +144,10 @@ export class LhispOauthClient { try { await this.getAccessToken(); - let headers = { + const headers = { "Content-Type": contentType, [this.tokenHeaderName]: this.getAuthToken(), + ...(this.headers || {}), }; const response = await axios.request({