Skip to content

fix: Return 400 for malformed request bodies#110

Merged
thced merged 1 commit into
masterfrom
fix/invalid-json
Jul 2, 2026
Merged

fix: Return 400 for malformed request bodies#110
thced merged 1 commit into
masterfrom
fix/invalid-json

Conversation

@thced

@thced thced commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

An unparseable request body (e.g. a double comma in JSON) made the body mapper throw its library-specific runtime exception, which fell through to the default 500 branch of the exception handler.

Convert any parse failure at the single mapper.readFrom call site into a ValidationException so it renders as a 400 application/problem+json response, consistent with the other body-validation errors. Covers all body mappers.

@thced thced force-pushed the fix/invalid-json branch 2 times, most recently from c18e988 to 3b30ebd Compare July 2, 2026 14:56
An unparseable request body (e.g. a double comma in JSON) made the body
mapper throw its library-specific runtime exception, which fell through to
the default 500 branch of the exception handler.

Convert any parse failure at the single mapper.readFrom call site into a
ValidationException so it renders as a 400 application/problem+json response,
consistent with the other body-validation errors. Covers all body mappers.
@thced thced force-pushed the fix/invalid-json branch from 3b30ebd to 0f3f30d Compare July 2, 2026 14:58
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@thced thced merged commit 87cd339 into master Jul 2, 2026
6 checks passed
@thced thced deleted the fix/invalid-json branch July 2, 2026 15:05
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