express-openapi-validator icon indicating copy to clipboard operation
express-openapi-validator copied to clipboard

Response validation not working as expected

Open guy-microsoft opened this issue 2 years ago • 2 comments
trafficstars

Describe the bug When I allow only 200 response code with application/json content, any response code is allowed if I set the response body as a string in my code.

To Reproduce image

Actual behavior Response passes the validation.

Expected behavior I would expected the response validation to fail the response.

Examples and context If I use res.status(209).json({}) instead of res.status(209).send(), validation works as expected

guy-microsoft avatar Apr 19 '23 15:04 guy-microsoft

Hey @guy-microsoft , Did you ever figure this out?

always-akshat avatar Jun 13 '23 15:06 always-akshat

No, but I only use .json (or .send with a json payload), so it mitigates that.

guy-microsoft avatar Jun 14 '23 07:06 guy-microsoft