OpenAPIValidators
OpenAPIValidators copied to clipboard
Validation of HTTP response header
OpenAPI version 3
Is your feature request related to a problem? Please describe. Currently the jest-openapi library validates the status and body of HTTP responses which works great. However, it doesnt seem to be validating the header of HTTP response even though it is specified in OpenAPI documentation.
Describe the solution you'd like Validation of HTTP response header
Thanks @Yilong94, I agree this would be useful.
Could you provide examples of specific use cases that we should support, so that whoever implements this enhancement can make sure they cover the top priorities?
Please show us some response objects (or responses from request packages) that would be valid/invalid against some example OpenAPI response definitions. Please suggest what assertion error you'd find useful.
(Ideally, use our simple Recreation template to create a simple runnable example)
Thanks!
A simple example is that the Content-Type
doesn't appear to be validated. I have a Content-Type
in my spec that doesn't match what the actual response has. I would have expected the call to satisfyApiSpec
fail when it still passed.
For example, if the spec has application/vnd.something+json
, but the response has application/vnd.somethingelse+json
, I would expect the assertion to fail.