Skip to content

Commit cfa7887

Browse files
committed
Allow passing request config to VBase's getJSON method
1 parent da787a8 commit cfa7887

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/clients/infra/VBase.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
inflightUrlWithQuery,
1212
InstanceOptions,
1313
IOResponse,
14+
RequestConfig,
1415
RequestTracingConfig,
1516
} from '../../HttpClient'
1617
import {
@@ -83,8 +84,15 @@ export class VBase extends InfraClient {
8384
}})
8485
}
8586

86-
public getJSON = <T>(bucket: string, path: string, nullIfNotFound?: boolean, conflictsResolver?: ConflictsResolver<T>, tracingConfig?: RequestTracingConfig) => {
87-
return this.getRawJSON<T>(bucket, path, nullIfNotFound, conflictsResolver, tracingConfig)
87+
public getJSON = <T>(
88+
bucket: string,
89+
path: string,
90+
nullIfNotFound?: boolean,
91+
conflictsResolver?: ConflictsResolver<T>,
92+
tracingConfig?: RequestTracingConfig,
93+
requestConfig?: RequestConfig
94+
) => {
95+
return this.getRawJSON<T>(bucket, path, nullIfNotFound, conflictsResolver, tracingConfig, requestConfig)
8896
.then(response => response.data)
8997
}
9098

@@ -93,7 +101,8 @@ export class VBase extends InfraClient {
93101
path: string,
94102
nullIfNotFound?: boolean,
95103
conflictsResolver?: ConflictsResolver<T>,
96-
tracingConfig?: RequestTracingConfig
104+
tracingConfig?: RequestTracingConfig,
105+
requestConfig?: RequestConfig
97106
) => {
98107
const headers = conflictsResolver ? { 'X-Vtex-Detect-Conflicts': true } : {}
99108
const inflightKey = inflightURL
@@ -108,6 +117,7 @@ export class VBase extends InfraClient {
108117
requestSpanNameSuffix: metric,
109118
...tracingConfig?.tracing,
110119
},
120+
...requestConfig
111121
} as IgnoreNotFoundRequestConfig)
112122
.catch(async (error: AxiosError<T>) => {
113123
const { response } = error

0 commit comments

Comments
 (0)