New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix empty reponse body when default status_code
is empty but the a Response
parameter with response.status_code
is set
#5360
Conversation
…onse content because wrong status code variable has been checked
Codecov Report
@@ Coverage Diff @@
## master #5360 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 539 540 +1
Lines 13918 13936 +18
=========================================
+ Hits 13918 13936 +18
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
📝 Docs preview for commit 834bb6d at: https://6318c7d257bf16323c910a72--fastapi.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Docs preview for commit a942d46 at: https://6319ffa9c38fb201c2c7a290--fastapi.netlify.app |
@iudeen can you elaborate what you mean by "...proper response code is reflecting in the api doc?" As you can see from the referenced link to the documentation it's supported to override the response code by setting the code on a |
I was meaning to say if we change response codes, it should reflect in Swagger (or Redoc) docs as well. But I now realize this behavior was not there before as well and seems its out of scope for this PR. LGTM! as it avoids the error below
👍 |
status_code
is empty but the a Response
parameter with response.status_code
is set
This PR contains a fix to a bug which cleared the reponse content if the status code is changed via a
Resource
parameter described in the documentation.Sample code which creates an empty response body: