diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fb1f343..f4b3cc5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.4.0" + ".": "4.4.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 46ddf8f..8a9d0d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.4.1 (2026-06-17) + +Full Changelog: [v4.4.0...v4.4.1](https://github.com/moderation-api/sdk-typescript/compare/v4.4.0...v4.4.1) + +### Bug Fixes + +* **client:** send content-type header for requests with an omitted optional body ([9addaf5](https://github.com/moderation-api/sdk-typescript/commit/9addaf5022954837794748a332601bcade5fd7d2)) + ## 4.4.0 (2026-06-02) Full Changelog: [v4.3.0...v4.4.0](https://github.com/moderation-api/sdk-typescript/compare/v4.3.0...v4.4.0) diff --git a/package.json b/package.json index 531c4a4..e748194 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moderation-api/sdk", - "version": "4.4.0", + "version": "4.4.1", "description": "The official TypeScript library for the Moderation API API", "author": "Moderation API ", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index 49684c7..482cff4 100644 --- a/src/client.ts +++ b/src/client.ts @@ -717,11 +717,19 @@ export class ModerationAPI { return () => controller.abort(); } - private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): { + private buildBody({ options }: { options: FinalRequestOptions }): { bodyHeaders: HeadersLike; body: BodyInit | undefined; } { + const { body, headers: rawHeaders } = options; if (!body) { + // A resource method always passes a `body` key when its operation defines a + // request body, even if the caller omitted an optional body param. Keep the + // content-type for those, and only elide it for operations with no body at + // all (e.g. GET/DELETE). + if (body == null && 'body' in options) { + return this.#encoder({ body, headers: buildHeaders([rawHeaders]) }); + } return { bodyHeaders: undefined, body: undefined }; } const headers = buildHeaders([rawHeaders]); diff --git a/src/version.ts b/src/version.ts index 8ab2514..5956b8d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.4.0'; // x-release-please-version +export const VERSION = '4.4.1'; // x-release-please-version