Skip to content

fix(lcm): Fixing invalid content type with version - #2091

Open
hung-nguyen-hoang wants to merge 1 commit into
masterfrom
GRIF-987
Open

fix(lcm): Fixing invalid content type with version#2091
hung-nguyen-hoang wants to merge 1 commit into
masterfrom
GRIF-987

Conversation

@hung-nguyen-hoang

@hung-nguyen-hoang hung-nguyen-hoang commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Jira: GRIF-987

Summary by CodeRabbit

  • Bug Fixes

    • Improved response handling so JSON data with versioned UTF-8 content types is parsed correctly.
    • Helps prevent errors when processing valid JSON responses that include content-type version information.
  • Chores

    • Updated the project version from 3.7.106 to 3.7.107.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@hung-nguyen-hoang, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b61abf72-c42d-4c79-a643-0c25653c174d

📥 Commits

Reviewing files that changed from the base of the PR and between 5ec681a and 71cc4a2.

📒 Files selected for processing (1)
  • lib/gooddata/rest/connection.rb
📝 Walkthrough

Walkthrough

The response parser now accepts versioned UTF-8 JSON content types. The project version was updated from 3.7.106 to 3.7.107.

Changes

JSON response handling

Layer / File(s) Summary
Versioned JSON detection
lib/gooddata/rest/connection.rb
process_response now recognizes JSON content types with version= and charset=UTF-8 parameters. A private helper performs the match.
Release version update
VERSION
The project version changed to 3.7.107.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: santos1709

Poem

I’m a rabbit with ears held high,
Parsing JSON as versions fly.
UTF-8 content now hops in line,
And release 3.7.107 looks fine.
Nibble, test, and ship on time!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing parsing for content types that include a version.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/gooddata/rest/connection.rb`:
- Around line 650-652: Update content_type_with_version so versioned
application/json content types are accepted without requiring charset=UTF-8;
retain the existing non-empty, JSON, and version checks so process_response
recognizes values such as application/json; version=1.
- Around line 650-652: Update content_type_with_version to return false when
content_type is nil before calling empty?, while preserving the existing
validation for non-nil content types.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e470b087-e4c8-4c37-9375-d9a5517ab8f1

📥 Commits

Reviewing files that changed from the base of the PR and between 9171f43 and 5ec681a.

📒 Files selected for processing (2)
  • VERSION
  • lib/gooddata/rest/connection.rb

Comment on lines +650 to +652
def content_type_with_version(content_type)
!content_type.empty? && content_type.include?('application/json') && content_type.include?('charset=UTF-8') && content_type.include?('version=')
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Recognize versioned JSON without requiring a charset parameter.

The supplied fixture spec/integration/vcr_cassettes/GoodData_AdsOutputStage/should_be_able_to_create_output_stage.yml, Line 11, contains application/json; version=1. The helper returns false because this value lacks charset=UTF-8. process_response then raises Unsupported response content type at Line 645. Make the charset parameter optional when the content type is versioned JSON.

Proposed fix
 def content_type_with_version(content_type)
-  !content_type.empty? && content_type.include?('application/json') && content_type.include?('charset=UTF-8') && content_type.include?('version=')
+  !content_type.empty? && content_type.include?('application/json') && content_type.include?('version=')
 end
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def content_type_with_version(content_type)
!content_type.empty? && content_type.include?('application/json') && content_type.include?('charset=UTF-8') && content_type.include?('version=')
end
def content_type_with_version(content_type)
!content_type.empty? && content_type.include?('application/json') && content_type.include?('version=')
end
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/gooddata/rest/connection.rb` around lines 650 - 652, Update
content_type_with_version so versioned application/json content types are
accepted without requiring charset=UTF-8; retain the existing non-empty, JSON,
and version checks so process_response recognizes values such as
application/json; version=1.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Prevent content_type_with_version from crashing on nil.

process_response already handles content_type.nil? at Line 640. The new call at Line 622 runs first. When the response has no Content-Type, Line 651 calls empty? on nil and raises NoMethodError. Return false before calling empty?.

Proposed fix
 def content_type_with_version(content_type)
-  !content_type.empty? && content_type.include?('application/json') && content_type.include?('charset=UTF-8') && content_type.include?('version=')
+  content_type && !content_type.empty? && content_type.include?('application/json') && content_type.include?('charset=UTF-8') && content_type.include?('version=')
 end
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def content_type_with_version(content_type)
!content_type.empty? && content_type.include?('application/json') && content_type.include?('charset=UTF-8') && content_type.include?('version=')
end
def content_type_with_version(content_type)
content_type && !content_type.empty? && content_type.include?('application/json') && content_type.include?('charset=UTF-8') && content_type.include?('version=')
end
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/gooddata/rest/connection.rb` around lines 650 - 652, Update
content_type_with_version to return false when content_type is nil before
calling empty?, while preserving the existing validation for non-nil content
types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant