@hey-api/openapi-ts 0.87.4 → 0.88.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.
- package/dist/clients/ofetch/client.ts +15 -2
- package/dist/{config-DHUTNwtw.d.ts → config-DCoXG8pO.d.ts} +2405 -1892
- package/dist/{config-CK1EGY2d.d.cts → config-DUT764Db.d.cts} +2479 -1966
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1622
- package/dist/index.d.ts +2 -1620
- package/dist/index.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/openApi-4Fl0M8gJ.js +17 -0
- package/dist/openApi-4Fl0M8gJ.js.map +1 -0
- package/dist/openApi-DGc8EfFq.cjs +17 -0
- package/dist/openApi-DGc8EfFq.cjs.map +1 -0
- package/dist/run.cjs +1 -1
- package/dist/run.cjs.map +1 -1
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/src-C88NdVoQ.js +11 -0
- package/dist/{src-D4L_i8zt.js.map → src-C88NdVoQ.js.map} +1 -1
- package/dist/src-D3LtFAXw.cjs +19 -0
- package/dist/{src-DmdEIcct.cjs.map → src-D3LtFAXw.cjs.map} +1 -1
- package/package.json +4 -4
- package/dist/chunk-C-EqMg7d.js +0 -1
- package/dist/openApi-BKUOqJVi.cjs +0 -19
- package/dist/openApi-BKUOqJVi.cjs.map +0 -1
- package/dist/openApi-QNcKaSPP.js +0 -19
- package/dist/openApi-QNcKaSPP.js.map +0 -1
- package/dist/src-D4L_i8zt.js +0 -11
- package/dist/src-DmdEIcct.cjs +0 -19
|
@@ -123,6 +123,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
123
123
|
const applyRequestInterceptors = async (
|
|
124
124
|
request: Request,
|
|
125
125
|
opts: ResolvedRequestOptions,
|
|
126
|
+
body: BodyInit | null | undefined,
|
|
126
127
|
) => {
|
|
127
128
|
for (const fn of interceptors.request.fns) {
|
|
128
129
|
if (fn) {
|
|
@@ -136,6 +137,18 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
136
137
|
// body comes only from getValidRequestBody(options)
|
|
137
138
|
// reflect signal if present
|
|
138
139
|
opts.signal = (request as any).signal as AbortSignal | undefined;
|
|
140
|
+
|
|
141
|
+
// When body is FormData, remove Content-Type header to avoid boundary mismatch.
|
|
142
|
+
// Note: We already delete Content-Type in resolveOptions for FormData, but the
|
|
143
|
+
// Request constructor (line 175) re-adds it with an auto-generated boundary.
|
|
144
|
+
// Since we pass the original FormData (not the Request's body) to ofetch, and
|
|
145
|
+
// ofetch will generate its own boundary, we must remove the Request's Content-Type
|
|
146
|
+
// to let ofetch set the correct one. Otherwise the boundary in the header won't
|
|
147
|
+
// match the boundary in the actual multipart body sent by ofetch.
|
|
148
|
+
if (typeof FormData !== 'undefined' && body instanceof FormData) {
|
|
149
|
+
opts.headers.delete('Content-Type');
|
|
150
|
+
}
|
|
151
|
+
|
|
139
152
|
return request;
|
|
140
153
|
};
|
|
141
154
|
|
|
@@ -174,7 +187,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
174
187
|
};
|
|
175
188
|
let request = new Request(url, requestInit);
|
|
176
189
|
|
|
177
|
-
request = await applyRequestInterceptors(request, opts);
|
|
190
|
+
request = await applyRequestInterceptors(request, opts, networkBody);
|
|
178
191
|
const finalUrl = request.url;
|
|
179
192
|
|
|
180
193
|
// build ofetch options and perform the request (.raw keeps the Response)
|
|
@@ -233,7 +246,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
233
246
|
method,
|
|
234
247
|
onRequest: async (url, init) => {
|
|
235
248
|
let request = new Request(url, init);
|
|
236
|
-
request = await applyRequestInterceptors(request, opts);
|
|
249
|
+
request = await applyRequestInterceptors(request, opts, networkBody);
|
|
237
250
|
return request;
|
|
238
251
|
},
|
|
239
252
|
serializedBody: networkBody as BodyInit | null | undefined,
|