Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions src/clients/infra/VBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
inflightUrlWithQuery,
InstanceOptions,
IOResponse,
RequestConfig,
RequestTracingConfig,
} from '../../HttpClient'
import {
Expand Down Expand Up @@ -83,8 +84,15 @@ export class VBase extends InfraClient {
}})
}

public getJSON = <T>(bucket: string, path: string, nullIfNotFound?: boolean, conflictsResolver?: ConflictsResolver<T>, tracingConfig?: RequestTracingConfig) => {
return this.getRawJSON<T>(bucket, path, nullIfNotFound, conflictsResolver, tracingConfig)
public getJSON = <T>(
bucket: string,
path: string,
nullIfNotFound?: boolean,
conflictsResolver?: ConflictsResolver<T>,
tracingConfig?: RequestTracingConfig,
requestConfig?: RequestConfig
) => {
return this.getRawJSON<T>(bucket, path, nullIfNotFound, conflictsResolver, tracingConfig, requestConfig)
.then(response => response.data)
}

Expand All @@ -93,7 +101,8 @@ export class VBase extends InfraClient {
path: string,
nullIfNotFound?: boolean,
conflictsResolver?: ConflictsResolver<T>,
tracingConfig?: RequestTracingConfig
tracingConfig?: RequestTracingConfig,
requestConfig?: RequestConfig
) => {
const headers = conflictsResolver ? { 'X-Vtex-Detect-Conflicts': true } : {}
const inflightKey = inflightURL
Expand All @@ -108,6 +117,7 @@ export class VBase extends InfraClient {
requestSpanNameSuffix: metric,
...tracingConfig?.tracing,
},
...requestConfig,
} as IgnoreNotFoundRequestConfig)
.catch(async (error: AxiosError<T>) => {
const { response } = error
Expand Down