Return 500 error when handler has wrong return type#8845
Return 500 error when handler has wrong return type#8845Dreamsorcerer merged 4 commits intomasterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #8845 +/- ##
==========================================
- Coverage 98.24% 98.23% -0.01%
==========================================
Files 107 107
Lines 34107 34094 -13
Branches 4050 4046 -4
==========================================
- Hits 33507 33493 -14
Misses 424 424
- Partials 176 177 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Perhaps, instead of returning a tuple, an exception wrapping the response could be raised and unwrapped/handled on the calling side? |
|
So, it's already covered by tests, they just asserted that the server would disconnect, which seems like an odd choice.. |
I don't think that works without more substantial refactoring. The actual writing happens in finish_response() where I create the replacement Response, the only reason I then return the new response, is because the calling function returns the resp to something else which accesses an attribute on it one more time, so I need it to replace the invalid resp object it passed in with the new one (back in .start() it accesses resp.keep_alive). |
|
@webknjaz Backport's broken... |
|
I know, GitHub's API response started including a new field which broke the mapping. I'll try to fix it today. |
|
Oh, that's timeline as well. So, won't be able to merge anything new at the moment. |
Backport to 3.10: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 48a5e07 on top of patchback/backports/3.10/48a5e07ad833bd1a8fcb2ce6f85a41ad0cef9dc6/pr-8845 Backporting merged PR #8845 into master
🤖 @patchback |
Backport to 3.11: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 48a5e07 on top of patchback/backports/3.11/48a5e07ad833bd1a8fcb2ce6f85a41ad0cef9dc6/pr-8845 Backporting merged PR #8845 into master
🤖 @patchback |
(cherry picked from commit 48a5e07)
(cherry picked from commit 48a5e07)
Fixes #4572.
Not entirely sure if this is the best solution. Will sort the test tomorrow.