Repository navigation
fix(rest): answer extractor rejections with google.rpc.Status - #451
Merged
muscariello merged 1 commit intoNov 2, 2026
Merged
muscariello merged 1 commit into
muscariello merged 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
muscariello
force-pushed
the
stack/12-rest-rejection-status
branch
2 times, most recently
from
November 2, 2026 12:02
388c1b8 to
5293813
Compare
The HTTP+JSON handlers took their input through axum's Json and Query extractors, so a malformed query, an undecodable body or a missing Content-Type was answered by axum before the handler, as a plain-text 400/415/422. HTTP+JSON errors use the google.rpc.Status body (§11.6), as #272 made the JSON-RPC router do. The rejections now go through the invalid-request-body response the handlers already return; a body over the size limit keeps its 413. Signed-off-by: gulldan <[email protected]>
muscariello
force-pushed
the
stack/12-rest-rejection-status
branch
from
November 2, 2026 14:28
5293813 to
008764c
Compare
msardara
approved these changes
Nov 2, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #425. Replaces #426. Stacked on #450: review only the last commit.
Cause: the HTTP+JSON handlers take input through axum's
JsonandQueryextractors. When one rejects the input (?historyLength=abc, an undecodable body, a missingContent-Type), axum answers before the handler with a plain-text 400, 415 or 422. §11.6 says HTTP+JSON errors use thegoogle.rpc.Statusbody, which the JSON-RPC router already follows.Fix: the affected handlers take
Result<Json<_>, JsonRejection>orResult<Query<_>, QueryRejection>, and a rejection is answered throughrest_payload_error_response: 400INVALID_ARGUMENTwith aBadRequestdetail. A body overDefaultBodyLimitkeeps axum's 413.Decision for review: a missing or wrong
Content-Typenow gives 400 with a Status body instead of a bare 415. #426 offered to keep 415 for that one case.Tests: one new test hits every touched extractor (bad
historyLength, badpageSizeon two routes, truncated bodies on three routes, noContent-Type) and expects 400,application/jsonandINVALID_ARGUMENT.Unproven: the failure on
mainwas not run locally. CI is the check.