OpenAPIValidators icon indicating copy to clipboard operation
OpenAPIValidators copied to clipboard

Validation of HTTP response header

Open Yilong94 opened this issue 4 years ago • 2 comments

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

Yilong94 avatar Nov 11 '20 02:11 Yilong94

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!

rwalle61 avatar Nov 11 '20 14:11 rwalle61

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.

hicksjacobp avatar May 05 '21 21:05 hicksjacobp