feat: parse headers
All checks were successful
CI Pipeline / build-and-test (push) Successful in 2m3s
CI Pipeline / publish (push) Successful in 37s

This commit is contained in:
Leandro Costa 2025-09-21 20:41:26 -03:00
parent 5b1699aff4
commit 5603323fe6
2 changed files with 5 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"name": "lhisp-oauth-client-dev",
"version": "1.0.33",
"version": "1.0.34",
"main": "src/index",
"types": "src/index.d.ts",
"repository": {

View file

@ -164,15 +164,17 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
data,
params,
contentType = ContentType.APPLICATION_JSON,
headers,
...opt
}: ExecutarRequestParams): Promise<ResponseType> {
try {
await this.getAccessToken();
const headers = {
const actualHeaders = {
"Content-Type": contentType,
[this.tokenHeaderName]: this.getAuthToken(),
...(this.headers || {}),
...(headers || {}),
};
const response = await axios.request<ResponseType>({
@ -180,7 +182,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
method,
url: `${this.apiUrl}${path}`,
httpsAgent: this.agent,
headers: { ...headers, ...opt.headers },
headers: actualHeaders,
data,
params,
timeout: this.timeout,