File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1030,11 +1030,19 @@ export class ModernTreasury {
10301030 return ( ) => controller . abort ( ) ;
10311031 }
10321032
1033- private buildBody ( { options : { body , headers : rawHeaders } } : { options : FinalRequestOptions } ) : {
1033+ private buildBody ( { options } : { options : FinalRequestOptions } ) : {
10341034 bodyHeaders : HeadersLike ;
10351035 body : BodyInit | undefined ;
10361036 } {
1037+ const { body, headers : rawHeaders } = options ;
10371038 if ( ! body ) {
1039+ // A resource method always passes a `body` key when its operation defines a
1040+ // request body, even if the caller omitted an optional body param. Keep the
1041+ // content-type for those, and only elide it for operations with no body at
1042+ // all (e.g. GET/DELETE).
1043+ if ( body == null && 'body' in options ) {
1044+ return this . #encoder( { body, headers : buildHeaders ( [ rawHeaders ] ) } ) ;
1045+ }
10381046 return { bodyHeaders : undefined , body : undefined } ;
10391047 }
10401048 const headers = buildHeaders ( [ rawHeaders ] ) ;
You can’t perform that action at this time.
0 commit comments