Return NoContent when mocking HTTP 204 operations#2000
Return NoContent when mocking HTTP 204 operations#2000Ruwann merged 13 commits intospec-first:mainfrom
Conversation
Never a need to return a response for HTTP 204
|
I guess you'll have to add/extend a test case to cover the newly added lines? |
leverage HTTP Status Enum and NoContent as resp
change import order
I can do that - not sure where to place this though. In |
|
Thanks @julienschuermans! I would indeed prefer to move it to the For the test, I think you can add:
It should be quite straight forward if you start from a copy of an existing test. Don't ask me why the numbering of the |
Return no content if code == 204
Status code check moved to example_response definition
return no content if status==204
Create NoContent mock test for Swagger
Create NoContent mock test for OpenAPI3
remove whitespace
Remove whitespace
|
I've moved the code into the |
|
I recommend you squash the 13 commits down to a single one. |
There was a problem hiding this comment.
Thanks, @julienschuermans. This one can be merged for me.
We can squash the commits during merging, as we're typically doing a squash and commit.
There's never a need to return a response for HTTP 204 - and these code are unlikely to have any "example" response documented in the spec.
Avoids a uvicorn RuntimeError
"Response content longer than Content-Length"when mocking a (3.0) spec containing:if/elsecheck into the operation'sexample_responsemethod. Thoughts?