File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -673,11 +673,19 @@ export class Fashn {
673673 return ( ) => controller . abort ( ) ;
674674 }
675675
676- private buildBody ( { options : { body , headers : rawHeaders } } : { options : FinalRequestOptions } ) : {
676+ private buildBody ( { options } : { options : FinalRequestOptions } ) : {
677677 bodyHeaders : HeadersLike ;
678678 body : BodyInit | undefined ;
679679 } {
680+ const { body, headers : rawHeaders } = options ;
680681 if ( ! body ) {
682+ // A resource method always passes a `body` key when its operation defines a
683+ // request body, even if the caller omitted an optional body param. Keep the
684+ // content-type for those, and only elide it for operations with no body at
685+ // all (e.g. GET/DELETE).
686+ if ( body == null && 'body' in options ) {
687+ return this . #encoder( { body, headers : buildHeaders ( [ rawHeaders ] ) } ) ;
688+ }
681689 return { bodyHeaders : undefined , body : undefined } ;
682690 }
683691 const headers = buildHeaders ( [ rawHeaders ] ) ;
You can’t perform that action at this time.
0 commit comments