File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
packages/openapi-ts/src/plugins/@hey-api/client-ofetch/bundle Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -139,10 +139,12 @@ export const createClient = (config: Config = {}): Client => {
139139 opts . signal = ( request as any ) . signal as AbortSignal | undefined ;
140140
141141 // When body is FormData, remove Content-Type header to avoid boundary mismatch.
142- // The Request constructor auto-generates a boundary and sets Content-Type, but
143- // we pass the original FormData to ofetch which will generate its own boundary.
144- // If we keep the Request's Content-Type, the boundary in the header won't match
145- // the boundary in the actual request body sent by ofetch.
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.
146148 if ( typeof FormData !== 'undefined' && body instanceof FormData ) {
147149 opts . headers . delete ( 'Content-Type' ) ;
148150 }
You can’t perform that action at this time.
0 commit comments