-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix(server/v2): post request fallback #23361
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
📝 WalkthroughWalkthroughThe pull request introduces changes to two files: Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
@technicallyty your pull request is missing a changelog! |
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)
server/v2/api/grpcgateway/interceptor.go (1)
147-157
: Consider using io.LimitReader for additional safetyWhile the implementation correctly handles request body reusability and includes a content length check, consider adding an extra safety measure:
- bodyBytes, err := io.ReadAll(req.Body) + bodyBytes, err := io.ReadAll(io.LimitReader(req.Body, MaxBodySize))This ensures the read operation stops at MaxBodySize even if the content-length header was incorrect or missing.
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
server/v2/api/grpcgateway/interceptor.go
(7 hunks)tests/systemtests/distribution_test.go
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/systemtests/distribution_test.go
🧰 Additional context used
📓 Path-based instructions (1)
server/v2/api/grpcgateway/interceptor.go (1)
Pattern **/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: tests (00)
- GitHub Check: test-simapp-v2
- GitHub Check: test-system-v2
- GitHub Check: test-sim-nondeterminism
- GitHub Check: test-integration
- GitHub Check: build (amd64)
- GitHub Check: Analyze
- GitHub Check: golangci-lint
- GitHub Check: Summary
🔇 Additional comments (5)
server/v2/api/grpcgateway/interceptor.go (5)
93-94
: LGTM! Improved error handling consistencyThe change to use
runtime.HTTPError
standardizes the error handling approach across the codebase while maintaining clear error messaging.
106-107
: LGTM! Clear error handling for invalid HTTP methodsThe error handling correctly identifies and reports unsupported HTTP methods with a clear message.
111-112
: LGTM! Consistent error propagationAppropriately forwards status errors while maintaining the standardized error handling approach.
122-124
: LGTM! Clear error handling for invalid height headerProvides clear error messaging with the specific invalid height value and uses appropriate error code.
226-234
: LGTM! Comprehensive HTTP rule handlingThe implementation properly handles all HTTP rules, including additional bindings, and correctly maps both GET and POST annotations.
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.
utACK.
(cherry picked from commit 265cb94) # Conflicts: # server/v2/api/grpcgateway/interceptor.go
Description
Closes: n/a
fixes a bug that causes fallback post requests to have unreadable bodies.
updates default gateway error handler.
fixes expected error output of distribution system test.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit
Bug Fixes
Refactor
The changes focus on improving error handling and test output consistency, ensuring more robust API interactions and test validation.