File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -709,11 +709,19 @@ export class CasParser {
709709 return ( ) => controller . abort ( ) ;
710710 }
711711
712- private buildBody ( { options : { body , headers : rawHeaders } } : { options : FinalRequestOptions } ) : {
712+ private buildBody ( { options } : { options : FinalRequestOptions } ) : {
713713 bodyHeaders : HeadersLike ;
714714 body : BodyInit | undefined ;
715715 } {
716+ const { body, headers : rawHeaders } = options ;
716717 if ( ! body ) {
718+ // A resource method always passes a `body` key when its operation defines a
719+ // request body, even if the caller omitted an optional body param. Keep the
720+ // content-type for those, and only elide it for operations with no body at
721+ // all (e.g. GET/DELETE).
722+ if ( body == null && 'body' in options ) {
723+ return this . #encoder( { body, headers : buildHeaders ( [ rawHeaders ] ) } ) ;
724+ }
717725 return { bodyHeaders : undefined , body : undefined } ;
718726 }
719727 const headers = buildHeaders ( [ rawHeaders ] ) ;
You can’t perform that action at this time.
0 commit comments