No response body in case of HTTP 201 throws validation error

Issue #100 closed
Former user created an issue

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)

  1. James Navin

    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.

  2. Log in to comment