Skip to content

Commit d40c1b2

Browse files
Build SDK
Stainless-Generated-From: ef28195be0dbd775172dd568e31d6f42aa9c45a8
1 parent ba2b558 commit d40c1b2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/client.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,19 @@ export class Together {
756756
return () => controller.abort();
757757
}
758758

759-
private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
759+
private buildBody({ options }: { options: FinalRequestOptions }): {
760760
bodyHeaders: HeadersLike;
761761
body: BodyInit | undefined;
762762
} {
763+
const { body, headers: rawHeaders } = options;
763764
if (!body) {
765+
// A resource method always passes a `body` key when its operation defines a
766+
// request body, even if the caller omitted an optional body param. Keep the
767+
// content-type for those, and only elide it for operations with no body at
768+
// all (e.g. GET/DELETE).
769+
if (body == null && 'body' in options) {
770+
return this.#encoder({ body, headers: buildHeaders([rawHeaders]) });
771+
}
764772
return { bodyHeaders: undefined, body: undefined };
765773
}
766774
const headers = buildHeaders([rawHeaders]);

0 commit comments

Comments
 (0)