Contract test: Handle responses with no body #239
savage-alex
started this conversation in
Ideas
Replies: 2 comments 10 replies
-
Definitively a good suggestion |
Beta Was this translation helpful? Give feedback.
6 replies
-
I'm going to link this discussion to an issue, so that we can create a PR for and close it afterwards, because this has become a valuable feature request. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
204 is a popular status code for PUT, POST and DELETE operations and MUST not have a response body says the RFC7231
In portman contract tests it correctly omits any body or schema checks if there is no content in the and API definition for the 2xx response. What it currently does not to is add a check for response body to be empty style test such as
pm.test("response should be empty", function () {
pm.response.to.not.be.withBody;
});
Is this something that would be useful to add to ensure we are not returning bodies when the contact is saying we shall not?
Beta Was this translation helpful? Give feedback.
All reactions