-
Notifications
You must be signed in to change notification settings - Fork 159
issue #1455 Admin CLI :: must treat any 2xx return from the Producer … #1456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…REST API as success
WalkthroughBroadened HTTP success handling in REST client to treat any 2xx response as success instead of only 200/201/204, and simplified imports to a wildcard for Apache Http client methods. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CLI as Admin CLI
participant RC as RESTClientApacheHttpImpl
participant HTTP as Producer REST API
CLI->>RC: sendRequest(payload)
RC->>HTTP: POST /execution-plans
HTTP-->>RC: HTTP response (status, body)
alt Status is 2xx (200–299)
note right of RC: New: 202, 204, etc. treated as success
RC-->>CLI: Success (response content)
else Non-2xx
RC-->>CLI: Throw HttpStatusException(status line, body)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests✅ Unit Test PR creation complete.
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. Comment |
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) |
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes issue #1455 by updating the REST client to treat any 2xx HTTP status code as successful instead of only specific codes (200, 201, 204). This change improves the robustness of the Admin CLI by accepting all standard success status codes from the Producer API.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
commons/src/main/scala/za/co/absa/spline/common/rest/RESTClientApacheHttpImpl.scala
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
commons/src/main/scala/za/co/absa/spline/common/rest/RESTClientApacheHttpImpl.scala (1)
101-106: Correctly treating any 2xx as success.This fixes the 202 handling. Optional: avoid returning null when the body is absent (e.g., 204/205) to reduce NPE risk for GET callers.
Apply this minimal change:
respStatusLine.getStatusCode match { - case code if (200 to 299) contains code => - respBody + case code if (200 to 299) contains code => + Option(respBody).getOrElse("") case _ => throw new HttpStatusException(respStatusLine.getStatusCode, s"$respStatusLine $respBody", request.toString) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
commons/src/main/scala/za/co/absa/spline/common/rest/RESTClientApacheHttpImpl.scala(2 hunks)
🔇 Additional comments (1)
commons/src/main/scala/za/co/absa/spline/common/rest/RESTClientApacheHttpImpl.scala (1)
22-22: Wildcard import is fine here; keep if you expect more HttpRequestBase variants.Make sure this aligns with your Scala style settings to avoid linter churn.
|
Note Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
|
✅ UTG Post-Process Complete No new issues were detected in the generated code and all check runs have completed. The unit test generation process has completed successfully. |
|
Creating a PR to put the unit tests in... The changes have been created in this pull request: View PR |



fixes #1455
Summary by CodeRabbit
Bug Fixes
Improvements