No response body in case of HTTP 201 throws validation error
Issue #100
closed
With a POST request to create a resource I am returning 201 on successful creation and location header with an empty response body. But I am getting exception on validation that "POST on path '/itms' defines a response schema but no response body found."
I am bit unsure about it. Even here https://tools.ietf.org/html/rfc7231#section-6.3.2 its not clearly written that the response body must be present. Please let me know what am I missing here. Thanks.
Comments (2)
-
-
- changed status to closed
Closing due to inactivity. If this is still an issue please feel free to re-open.
- Log in to comment
Does the response definition in your spec define a schema for the 201 response? An empty response is valid according to the HTTP spec, but if your swagger API spec defines a body then the validator will expect there to be one. As far as I know Swagger v2.0 doesn't support 'optional' response bodies.