@hey-api/openapi-ts 0.83.1 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,7 +78,7 @@ export const createClient = (config: Config = {}): Client => {
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
@@ -149,7 +149,7 @@ type BuildUrlFn = <
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<
@@ -123,9 +123,16 @@ export const setAuthParams = async ({
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,6 +142,7 @@ export const buildUrl: Client['buildUrl'] = (options) =>
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 };