From f13fabe171469e50e8c101dda184d3cbc1e3a6b2 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Thu, 4 Jan 2024 14:41:13 -0300 Subject: [PATCH 1/2] feat: implementando timeout --- src/lhisp-oauth-client.t.ts | 1 + src/lhisp-oauth-client.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/lhisp-oauth-client.t.ts b/src/lhisp-oauth-client.t.ts index 38e5dfc..df941fe 100644 --- a/src/lhisp-oauth-client.t.ts +++ b/src/lhisp-oauth-client.t.ts @@ -22,6 +22,7 @@ export interface LhispOauthClientConstructorParams { sendAuthCredentialsOnRequestBody?: boolean; formatAccessToken?: (accessToken?: AccessToken) => string; debug?: boolean; + timeout?: number; } export interface ExecutarRequestParams extends AxiosRequestConfig { diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index fd62132..3075eed 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -34,6 +34,7 @@ export class LhispOauthClient { protected tokenCreatedAt = 0; protected tokenExpiresIn = 0; protected sendAuthCredentialsOnRequestBody?: boolean; + protected timeout: number; protected formatAccessToken?: (accessToken?: iAccessToken) => string; constructor(params: LhispOauthClientConstructorParams) { @@ -64,6 +65,7 @@ export class LhispOauthClient { this.tokenHeaderName = params.tokenHeaderName || defaultTokenHeaderName; this.sendAuthCredentialsOnRequestBody = params.sendAuthCredentialsOnRequestBody; this.formatAccessToken = params.formatAccessToken; + this.timeout = params.timeout ? params.timeout : 60000; } getAuthHeaderValue(): string { @@ -110,6 +112,7 @@ export class LhispOauthClient { data: { ...this.authData, }, + timeout: this.timeout, }; if (this.grantType) authRequestOpt.data.grant_type = this.grantType; @@ -171,6 +174,7 @@ export class LhispOauthClient { headers, data, params, + timeout: this.timeout, ...opt, }); From ffae4e9bed43ea3d4fe09e1b16aeb8ebb5261de2 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Thu, 4 Jan 2024 17:42:09 +0000 Subject: [PATCH 2/2] [skip CI] Version 1.0.27 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7be6088..8ff5b2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lhisp-oauth-client", - "version": "1.0.26", + "version": "1.0.27", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lhisp-oauth-client", - "version": "1.0.26", + "version": "1.0.27", "license": "MIT", "dependencies": { "axios": "^1.6.1", diff --git a/package.json b/package.json index 31cab23..c7a1e78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lhisp-oauth-client", - "version": "1.0.26", + "version": "1.0.27", "main": "src/index", "types": "src/index.d.ts", "repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git",