File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1086,11 +1086,19 @@ export class Lithic {
10861086 return ( ) => controller . abort ( ) ;
10871087 }
10881088
1089- private buildBody ( { options : { body , headers : rawHeaders } } : { options : FinalRequestOptions } ) : {
1089+ private buildBody ( { options } : { options : FinalRequestOptions } ) : {
10901090 bodyHeaders : HeadersLike ;
10911091 body : BodyInit | undefined ;
10921092 } {
1093+ const { body, headers : rawHeaders } = options ;
10931094 if ( ! body ) {
1095+ // A resource method always passes a `body` key when its operation defines a
1096+ // request body, even if the caller omitted an optional body param. Keep the
1097+ // content-type for those, and only elide it for operations with no body at
1098+ // all (e.g. GET/DELETE).
1099+ if ( body == null && 'body' in options ) {
1100+ return this . #encoder( { body, headers : buildHeaders ( [ rawHeaders ] ) } ) ;
1101+ }
10941102 return { bodyHeaders : undefined , body : undefined } ;
10951103 }
10961104 const headers = buildHeaders ( [ rawHeaders ] ) ;
You can’t perform that action at this time.
0 commit comments