fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2624 from Ben-Pfirsich/fix/remove-baseUrl-from-axios-url-build

fix: remove duplicate baseUrl in axios client

authored by

Lubos and committed by
GitHub
1512832e 1cc31e78

+636 -150
+5
.changeset/rare-kangaroos-try.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + fix(axios): remove duplicate `baseURL` when using relative values
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts
··· 80 80 const { auth, ...optsWithoutAuth } = opts; 81 81 const response = await _axios({ 82 82 ...optsWithoutAuth, 83 - baseURL: opts.baseURL as string, 83 + baseURL: '', // the baseURL is already included in `url` 84 84 data: getValidRequestBody(opts), 85 85 headers: opts.headers as RawAxiosRequestHeaders, 86 86 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/types.gen.ts
··· 151 151 url: string; 152 152 }, 153 153 >( 154 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 154 + options: Pick<TData, 'url'> & Options<TData>, 155 155 ) => string; 156 156 157 157 export type Client = CoreClient<
+11 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/utils.gen.ts
··· 125 125 } 126 126 }; 127 127 128 - export const buildUrl: Client['buildUrl'] = (options) => 129 - getUrl({ 130 - baseUrl: options.baseURL as string, 128 + export const buildUrl: Client['buildUrl'] = (options) => { 129 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 130 + 131 + const baseUrl = 132 + !!options.baseURL && typeof options.baseURL === 'string' 133 + ? options.baseURL 134 + : instanceBaseUrl; 135 + 136 + return getUrl({ 137 + baseUrl: baseUrl as string, 131 138 path: options.path, 132 139 // let `paramsSerializer()` handle query params if it exists 133 140 query: !options.paramsSerializer ? options.query : undefined, ··· 137 144 : createQuerySerializer(options.querySerializer), 138 145 url: options.url, 139 146 }); 147 + }; 140 148 141 149 export const mergeConfigs = (a: Config, b: Config): Config => { 142 150 const config = { ...a, ...b };
+184
packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/client.test.ts
··· 168 168 }, 169 169 ); 170 170 }); 171 + 172 + describe('calling axios instance', () => { 173 + it.each([ 174 + { 175 + description: 'with absolute baseURL', 176 + expectedURL: 'https://api.example.com/users', 177 + instanceBaseURL: 'https://api.example.com', 178 + optionsURL: '/users', 179 + }, 180 + { 181 + description: 'without baseURL', 182 + expectedURL: '/users', 183 + instanceBaseURL: undefined, 184 + optionsURL: '/users', 185 + }, 186 + { 187 + description: 'with relative baseURL', 188 + expectedURL: '/some-base-url/users', 189 + instanceBaseURL: '/some-base-url', 190 + optionsURL: '/users', 191 + }, 192 + ])( 193 + 'should call the axios instance with correct baseURL and url $description configured via createClient', 194 + async ({ expectedURL, instanceBaseURL, optionsURL }) => { 195 + const client = createClient({ baseURL: instanceBaseURL }); 196 + const mockAxios = vi.fn().mockResolvedValue({ data: { ok: true } }); 197 + 198 + const options = { 199 + axios: mockAxios as Partial<AxiosInstance> as AxiosInstance, 200 + headers: {}, 201 + url: optionsURL, 202 + }; 203 + 204 + await client.get(options); 205 + 206 + expect(mockAxios).toHaveBeenCalledWith( 207 + expect.objectContaining({ 208 + baseURL: '', 209 + url: expectedURL, 210 + }), 211 + ); 212 + }, 213 + ); 214 + 215 + it.each([ 216 + { 217 + description: 'with absolute baseURL', 218 + expectedURL: 'https://api.example.com/some-base-url/users', 219 + optionsBaseURL: 'https://api.example.com/some-base-url', 220 + optionsURL: '/users', 221 + }, 222 + { 223 + description: 'with relative baseURL', 224 + expectedURL: '/some-base-url/users', 225 + optionsBaseURL: '/some-base-url', 226 + optionsURL: '/users', 227 + }, 228 + ])( 229 + 'should call the axios instance with correct url $description configured via request options', 230 + async ({ expectedURL, optionsBaseURL, optionsURL }) => { 231 + const client = createClient({ 232 + baseURL: 'base-url-that-will-be-overridden', 233 + }); 234 + 235 + const mockAxios = vi.fn().mockResolvedValue({ data: { ok: true } }); 236 + 237 + const options = { 238 + axios: mockAxios as Partial<AxiosInstance> as AxiosInstance, 239 + baseURL: optionsBaseURL, 240 + headers: {}, 241 + url: optionsURL, 242 + }; 243 + 244 + await client.get(options); 245 + 246 + expect(mockAxios).toHaveBeenCalledWith( 247 + expect.objectContaining({ 248 + baseURL: '', 249 + url: expectedURL, 250 + }), 251 + ); 252 + }, 253 + ); 254 + 255 + it('should call the axios instance with correct url when baseURL configured via axios defaults', async () => { 256 + const client = createClient(); 257 + 258 + const mockAxios = vi.fn().mockResolvedValue({ 259 + data: { ok: true }, 260 + }) as Partial<AxiosInstance> as AxiosInstance; 261 + mockAxios.defaults = { baseURL: '/some-base-url', headers: {} as any }; 262 + 263 + const options = { 264 + axios: mockAxios, 265 + headers: {}, 266 + url: '/users', 267 + }; 268 + 269 + await client.get(options); 270 + 271 + expect(mockAxios).toHaveBeenCalledWith( 272 + expect.objectContaining({ 273 + baseURL: '', 274 + url: '/some-base-url/users', 275 + }), 276 + ); 277 + }); 278 + 279 + it('should prefer passed baseUrl over configs', async () => { 280 + const client = createClient({ baseURL: 'base-url-from-config-1' }); 281 + 282 + const mockAxios = vi.fn().mockResolvedValue({ 283 + data: { ok: true }, 284 + }) as Partial<AxiosInstance> as AxiosInstance; 285 + mockAxios.defaults = { 286 + baseURL: 'base-url-from-config-2', 287 + headers: {} as any, 288 + }; 289 + 290 + const options = { 291 + axios: mockAxios, 292 + baseURL: '/some-base-url', 293 + headers: {}, 294 + url: '/users', 295 + }; 296 + 297 + await client.get(options); 298 + 299 + expect(mockAxios).toHaveBeenCalledWith( 300 + expect.objectContaining({ 301 + baseURL: '', 302 + url: '/some-base-url/users', 303 + }), 304 + ); 305 + }); 306 + }); 307 + 308 + // TODO: remove this after confirmation 309 + describe('confirming axios behaviour for constructing URLs', () => { 310 + it('resolves relative URLs against baseURL', async () => { 311 + const client = axios.create({ 312 + baseURL: 'https://api.example.com', 313 + }); 314 + 315 + const config = client.getUri({ url: '/users' }); 316 + expect(config).toBe('https://api.example.com/users'); 317 + }); 318 + 319 + it('resolves relative URLs against relative baseURL', async () => { 320 + const client = axios.create({ 321 + baseURL: '/example', 322 + }); 323 + 324 + const config = client.getUri({ url: '/users' }); 325 + expect(config).toBe('/example/users'); 326 + }); 327 + 328 + it('does not prepend baseURL when url is absolute', async () => { 329 + const client = axios.create({ 330 + baseURL: 'https://api.example.com', 331 + }); 332 + 333 + const config = client.getUri({ url: 'https://other.com/users' }); 334 + expect(config).toBe('https://other.com/users'); 335 + }); 336 + 337 + it('does not prepend baseURL when overriding baseURL with empty string', async () => { 338 + const client = axios.create({ 339 + baseURL: 'https://api.example.com', 340 + }); 341 + 342 + const config = client.getUri({ baseURL: '', url: '/users' }); 343 + expect(config).toBe('/users'); 344 + }); 345 + 346 + it('does prepend baseURL when overriding baseURL with undefined', async () => { 347 + const client = axios.create({ 348 + baseURL: 'https://api.example.com', 349 + }); 350 + 351 + const config = client.getUri({ baseURL: undefined, url: '/users' }); 352 + expect(config).toBe('https://api.example.com/users'); 353 + }); 354 + });
+57
packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/utils-buildUrl.test.ts
··· 1 + import { afterEach, describe, expect, it, vi } from 'vitest'; 2 + 3 + import type { QuerySerializer } from '../../client-core/bundle/bodySerializer'; 4 + 5 + describe('buildUrl', () => { 6 + afterEach(() => { 7 + vi.resetAllMocks(); 8 + vi.resetModules(); 9 + }); 10 + 11 + it.each([ 12 + { 13 + description: 'with query params', 14 + expectedUrl: '/some-url?param1=some-query-param', 15 + inputOptions: { 16 + baseUrl: 'some-base-url', 17 + path: { param1: 'some-path-param' }, 18 + query: { param1: 'some-query-param' }, 19 + querySerializer: (() => 'param1=some-query-param') as QuerySerializer, 20 + url: '/some-url', 21 + }, 22 + }, 23 + { 24 + description: 'without query params', 25 + expectedUrl: '/some-url', 26 + inputOptions: { 27 + baseURL: 'some-base-url', 28 + path: { param1: 'some-path-param' }, 29 + query: undefined, 30 + querySerializer: (() => '') as QuerySerializer, 31 + url: '/some-url', 32 + }, 33 + }, 34 + ])( 35 + 'passes correct parameters to getUrl $description', 36 + async ({ expectedUrl, inputOptions }) => { 37 + const getUrlMock = vi.fn().mockReturnValue(expectedUrl); 38 + vi.doMock('../../client-core/bundle/utils', async () => ({ 39 + getUrl: getUrlMock, 40 + })); 41 + 42 + const { buildUrl } = await import('../bundle/utils'); 43 + 44 + const builtUrl = buildUrl(inputOptions); 45 + 46 + expect(builtUrl).toBe(expectedUrl); 47 + 48 + expect(getUrlMock).toHaveBeenCalledExactlyOnceWith({ 49 + baseUrl: inputOptions.baseURL, 50 + path: inputOptions.path, 51 + query: inputOptions.query, 52 + querySerializer: inputOptions.querySerializer, 53 + url: inputOptions.url, 54 + }); 55 + }, 56 + ); 57 + });
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts
··· 78 78 const { auth, ...optsWithoutAuth } = opts; 79 79 const response = await _axios({ 80 80 ...optsWithoutAuth, 81 - baseURL: opts.baseURL as string, 81 + baseURL: '', // the baseURL is already included in `url` 82 82 data: getValidRequestBody(opts), 83 83 headers: opts.headers as RawAxiosRequestHeaders, 84 84 // let `paramsSerializer()` handle query params if it exists
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/types.ts
··· 149 149 url: string; 150 150 }, 151 151 >( 152 - options: Pick<TData, 'url'> & Omit<Options<TData>, 'axios'>, 152 + options: Pick<TData, 'url'> & Options<TData>, 153 153 ) => string; 154 154 155 155 export type Client = CoreClient<
+11 -3
packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/utils.ts
··· 123 123 } 124 124 }; 125 125 126 - export const buildUrl: Client['buildUrl'] = (options) => 127 - getUrl({ 128 - baseUrl: options.baseURL as string, 126 + export const buildUrl: Client['buildUrl'] = (options) => { 127 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 128 + 129 + const baseUrl = 130 + !!options.baseURL && typeof options.baseURL === 'string' 131 + ? options.baseURL 132 + : instanceBaseUrl; 133 + 134 + return getUrl({ 135 + baseUrl: baseUrl as string, 129 136 path: options.path, 130 137 // let `paramsSerializer()` handle query params if it exists 131 138 query: !options.paramsSerializer ? options.query : undefined, ··· 135 142 : createQuerySerializer(options.querySerializer), 136 143 url: options.url, 137 144 }); 145 + }; 138 146 139 147 export const mergeConfigs = (a: Config, b: Config): Config => { 140 148 const config = { ...a, ...b };