diff --git a/src/clients/uploads-api-client.ts b/src/clients/uploads-api-client.ts index 531c12e1..371b178b 100644 --- a/src/clients/uploads-api-client.ts +++ b/src/clients/uploads-api-client.ts @@ -1,16 +1,15 @@ import { UploadsApi } from '../api-models/uploads-api-model' import { ApiClientHelpers } from '../helpers' -import { isJsonMime } from '../helpers/is-json-mime' import { APIConfigurationParameters } from '../types/api-configuration-parameters' export class UploadsApiClient extends UploadsApi { constructor(parameters?: APIConfigurationParameters) { const axios = ApiClientHelpers.assertAxiosInstance(parameters) - const basePath = ApiClientHelpers.assertBasePath() + const basePath = ApiClientHelpers.getDefaultBasePath() super( { - isJsonMime, + isJsonMime: ApiClientHelpers.isJsonMime, ...parameters, }, basePath, diff --git a/src/helpers/api-client-helpers.ts b/src/helpers/api-client-helpers.ts index 97d6a85f..1351b9c0 100644 --- a/src/helpers/api-client-helpers.ts +++ b/src/helpers/api-client-helpers.ts @@ -23,8 +23,16 @@ export class ApiClientHelpers { return axiosInstance } - static assertBasePath(): string { + static getDefaultBasePath(): string { const { sellingPartner } = amazonMarketplaces.US return sellingPartner ? sellingPartner.region.endpoint : '' } + + static isJsonMime(mime: string): boolean { + /* eslint-disable-next-line no-control-regex */ + const jsonMime = new RegExp('^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i') + return ( + mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json') + ) + } } diff --git a/src/helpers/index.ts b/src/helpers/index.ts index 9655bba4..c8e1a22d 100644 --- a/src/helpers/index.ts +++ b/src/helpers/index.ts @@ -1,4 +1,3 @@ export * from './api-client-helpers' export * from './api-error-factory' export * from './decoder' -export * from './is-json-mime' diff --git a/src/helpers/is-json-mime.ts b/src/helpers/is-json-mime.ts deleted file mode 100644 index 0f262eb9..00000000 --- a/src/helpers/is-json-mime.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function isJsonMime(mime: string): boolean { - /* eslint-disable-next-line no-control-regex */ - const jsonMime = new RegExp('^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i') - return ( - mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json') - ) -}