Skip to content

Skip a non-JSON body when the content type is not JSON either - #84

Merged
DerManoMann merged 1 commit into
mainfrom
fix/non-json-content-type
Oct 13, 2026
Merged

DerManoMann merged 1 commit into
mainfrom
fix/non-json-content-type

Conversation

@DerManoMann

Copy link
Copy Markdown
Owner

A response with a Content-Type the specification does not document falls back to the application/json schema. That is right for a JSON body labelled text/html, but an application/xml body on an operation that documents only JSON was reported as a mismatch, since it decodes to null.

Such a body is now skipped, like a response without a schema. A body that is not JSON still fails when the content type is JSON or missing.

  • OpenApiVerifier::verifyResponseBody() skips it
  • four test cases, one for each combination
  • the README's media type and "What is verified" bullets

`OpenApiVerifier::verifyResponseBody()` returns `false` for a body that
does not decode when the response's `Content-Type` is set and not JSON.
The README's media type and "What is verified" bullets say so.
@DerManoMann
DerManoMann merged commit ef4f634 into main Oct 13, 2026
21 checks passed
@DerManoMann
DerManoMann deleted the fix/non-json-content-type branch October 13, 2026 06:42
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