Skip to content

fix(http): refuse malformed requests as an ApiError - #173

Open
PiquelChips wants to merge 1 commit into
fix/hold-whole-seconds-in-a-periodfrom
fix/refuse-malformed-requests-as-an-apierror
Open

PiquelChips wants to merge 1 commit into
fix/hold-whole-seconds-in-a-periodfrom
fix/refuse-malformed-requests-as-an-apierror

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

When axum's Path, Query or Json extractors refused a request, for a malformed query or body, the client got axum's plain-text rejection, not the ApiError every other failure returns, so the SDK couldn't say why. The routes now extract through Path, Query and Json wrappers, declared by a small macro, whose rejection is an HttpError. A client error comes back as a bad_request ApiError. A route that doesn't match its handler, which is a server bug, comes back as an internal error and is logged. The wrappers keep axum's names, so the OpenAPI document doesn't change. A new HTTP test sends a malformed query and a malformed body and expects a 400 ApiError for each. It adds reqwest as a dev-dependency of origin-src, since the SDK never sends such requests.

Part of #166.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d0e8a779-900a-4c53-b37e-eac33a391cb1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@PiquelChips
PiquelChips added this pull request to stack #185 November 22, 2026 20:21
@PiquelChips
PiquelChips removed this pull request from stack #185 November 22, 2026 20:22
A request whose path, query or JSON body axum's extractors refused got
axum's plain-text rejection, not the ApiError every other failure is, so
clients couldn't read why. The routes now extract through Path, Query and
Json wrappers whose rejection is an HttpError: a client error is a
bad_request ApiError, and a route that doesn't match its handler an
internal one, logged.
@PiquelChips
PiquelChips force-pushed the fix/hold-whole-seconds-in-a-period branch from 9ca64c3 to c1a7051 Compare November 22, 2026 20:22
@PiquelChips
PiquelChips force-pushed the fix/refuse-malformed-requests-as-an-apierror branch from 705515a to 72b9471 Compare November 22, 2026 20:22
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