Skip to content

Return JSON 422 for non-JSON validation failures#101

Open
kingpy-bot wants to merge 1 commit into
morcen:mainfrom
kingpy-bot:kingpy/fix-validation-422-98
Open

Return JSON 422 for non-JSON validation failures#101
kingpy-bot wants to merge 1 commit into
morcen:mainfrom
kingpy-bot:kingpy/fix-validation-422-98

Conversation

@kingpy-bot

Copy link
Copy Markdown
Contributor

Fixes #98.

What changed

  • catch Laravel validation failures inside the Passage controller
  • return the documented JSON 422 response regardless of Accept headers or session middleware
  • preserve the field-level validation errors and stop before any upstream request
  • add regression coverage for a plain POST that does not advertise JSON

This keeps ValidatesInboundRequest behavior consistent for webhook and API-gateway clients instead of falling into Laravel's redirect/session response path.

Verification

  • focused validation tests: 3 passed, 8 assertions
  • vendor/bin/pest: 104 tests passed, 263 assertions
  • vendor/bin/pint --test on both touched files: passed
  • git diff --check: passed

AI-assisted implementation and verification.

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.

ValidatesInboundRequest's "returns 422 automatically" promise breaks for non-JSON-expecting requests

1 participant