From cfa7887d1e66ba6bff3a184ced343116543961b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mai=CC=81ra=20Bello?= Date: Mon, 30 Oct 2023 15:18:09 -0300 Subject: [PATCH 1/3] Allow passing request config to VBase's getJSON method --- src/clients/infra/VBase.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/clients/infra/VBase.ts b/src/clients/infra/VBase.ts index 291ab918e..be917dd56 100644 --- a/src/clients/infra/VBase.ts +++ b/src/clients/infra/VBase.ts @@ -11,6 +11,7 @@ import { inflightUrlWithQuery, InstanceOptions, IOResponse, + RequestConfig, RequestTracingConfig, } from '../../HttpClient' import { @@ -83,8 +84,15 @@ export class VBase extends InfraClient { }}) } - public getJSON = (bucket: string, path: string, nullIfNotFound?: boolean, conflictsResolver?: ConflictsResolver, tracingConfig?: RequestTracingConfig) => { - return this.getRawJSON(bucket, path, nullIfNotFound, conflictsResolver, tracingConfig) + public getJSON = ( + bucket: string, + path: string, + nullIfNotFound?: boolean, + conflictsResolver?: ConflictsResolver, + tracingConfig?: RequestTracingConfig, + requestConfig?: RequestConfig + ) => { + return this.getRawJSON(bucket, path, nullIfNotFound, conflictsResolver, tracingConfig, requestConfig) .then(response => response.data) } @@ -93,7 +101,8 @@ export class VBase extends InfraClient { path: string, nullIfNotFound?: boolean, conflictsResolver?: ConflictsResolver, - tracingConfig?: RequestTracingConfig + tracingConfig?: RequestTracingConfig, + requestConfig?: RequestConfig ) => { const headers = conflictsResolver ? { 'X-Vtex-Detect-Conflicts': true } : {} const inflightKey = inflightURL @@ -108,6 +117,7 @@ export class VBase extends InfraClient { requestSpanNameSuffix: metric, ...tracingConfig?.tracing, }, + ...requestConfig } as IgnoreNotFoundRequestConfig) .catch(async (error: AxiosError) => { const { response } = error From eba4ac90c3529aeee9a1fbef899708cc02415b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mai=CC=81ra=20Bello?= Date: Wed, 8 Nov 2023 10:49:48 -0300 Subject: [PATCH 2/3] Fix lint --- src/clients/infra/VBase.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clients/infra/VBase.ts b/src/clients/infra/VBase.ts index be917dd56..e9a833e96 100644 --- a/src/clients/infra/VBase.ts +++ b/src/clients/infra/VBase.ts @@ -117,7 +117,7 @@ export class VBase extends InfraClient { requestSpanNameSuffix: metric, ...tracingConfig?.tracing, }, - ...requestConfig + ...requestConfig, } as IgnoreNotFoundRequestConfig) .catch(async (error: AxiosError) => { const { response } = error From 64cce6c9a55ff3f1720a33bbe4bd5b9a544a4141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mai=CC=81ra=20Bello?= Date: Wed, 8 Nov 2023 11:01:06 -0300 Subject: [PATCH 3/3] Add CHANGELOG entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 059e7eae0..31144a03d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added +- Allow passing request config to VBase's getJSON method + ## [6.46.0] - 2023-10-25 ### Added - Add disk cache steps and retry count to tracing