From fb1960aab2de9c04cdb3985f7d75f503eca0b3b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Dec 2025 09:06:00 +0000 Subject: [PATCH 1/2] fix: issue where json.parse errors when receiving HTTP 204 with nobody --- lib/moderation_api/internal/util.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/moderation_api/internal/util.rb b/lib/moderation_api/internal/util.rb index 2403094..65240ec 100644 --- a/lib/moderation_api/internal/util.rb +++ b/lib/moderation_api/internal/util.rb @@ -657,7 +657,8 @@ def force_charset!(content_type, text:) def decode_content(headers, stream:, suppress_error: false) case (content_type = headers["content-type"]) in ModerationAPI::Internal::Util::JSON_CONTENT - json = stream.to_a.join + return nil if (json = stream.to_a.join).empty? + begin JSON.parse(json, symbolize_names: true) rescue JSON::ParserError => e @@ -667,7 +668,11 @@ def decode_content(headers, stream:, suppress_error: false) in ModerationAPI::Internal::Util::JSONL_CONTENT lines = decode_lines(stream) chain_fused(lines) do |y| - lines.each { y << JSON.parse(_1, symbolize_names: true) } + lines.each do + next if _1.empty? + + y << JSON.parse(_1, symbolize_names: true) + end end in %r{^text/event-stream} lines = decode_lines(stream) From 346d9c57efb420120d67e05476839b80325fbe3d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Dec 2025 09:06:17 +0000 Subject: [PATCH 2/2] release: 2.2.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/moderation_api/version.rb | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bfc26f9..89d8ff8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.2.0" + ".": "2.2.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c166de..899e61d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.2.1 (2025-12-19) + +Full Changelog: [v2.2.0...v2.2.1](https://github.com/moderation-api/sdk-ruby/compare/v2.2.0...v2.2.1) + +### Bug Fixes + +* issue where json.parse errors when receiving HTTP 204 with nobody ([fb1960a](https://github.com/moderation-api/sdk-ruby/commit/fb1960aab2de9c04cdb3985f7d75f503eca0b3b8)) + ## 2.2.0 (2025-12-18) Full Changelog: [v2.1.1...v2.2.0](https://github.com/moderation-api/sdk-ruby/compare/v2.1.1...v2.2.0) diff --git a/Gemfile.lock b/Gemfile.lock index 481266b..dc5d4a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - moderation_api (2.2.0) + moderation_api (2.2.1) connection_pool GEM diff --git a/README.md b/README.md index 6041e83..0a33412 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "moderation_api", "~> 2.2.0" +gem "moderation_api", "~> 2.2.1" ``` diff --git a/lib/moderation_api/version.rb b/lib/moderation_api/version.rb index e2a02bd..9f42440 100644 --- a/lib/moderation_api/version.rb +++ b/lib/moderation_api/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ModerationAPI - VERSION = "2.2.0" + VERSION = "2.2.1" end