Skip to content
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

✨ Allow custom middlewares to raise HTTPExceptions and propagate them #2036

Merged
merged 5 commits into from Aug 25, 2022

Conversation

ghandic
Copy link
Contributor

@ghandic ghandic commented Sep 11, 2020

When trying to build a custom middleware that checks content size any exceptions raised by the middleware don't get propagated back up. By allowing any HTTPExceptions to be raised as they are we can raise custom exception information into the response

Screenshot 2020-09-11 at 18 20 03

@codecov
Copy link

codecov bot commented Sep 11, 2020

Codecov Report

Merging #2036 (4a4a545) into master (5215b39) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     #2036   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          533       534    +1     
  Lines        13755     13808   +53     
=========================================
+ Hits         13755     13808   +53     
Impacted Files Coverage Δ
fastapi/routing.py 100.00% <100.00%> (ø)
tests/test_custom_middleware_exception.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link
Contributor

📝 Docs preview for commit 6e01c59e9ad6225d20fea2db76aa3efc9ef79246 at: https://5f5b4da78fae0e00b631355d--fastapi.netlify.app

… middleware to surface up through the use of HTTPException, tests to complement it as added additional exception branching
@ghandic
Copy link
Contributor Author

ghandic commented Sep 12, 2020

Squashed my commits into one

@ghandic ghandic changed the title Fix to allow custom middleware Exceptions to be propagated through Fix to allow custom middleware HTTPExceptions to be propagated through Sep 12, 2020
@github-actions
Copy link
Contributor

📝 Docs preview for commit 2ef2a55 at: https://5f5c74d3c3abcba7c1cbb5bf--fastapi.netlify.app

@ghandic
Copy link
Contributor Author

ghandic commented Nov 7, 2020

@tiangolo this was the main PR I was requesting, the other one I just thought I had found an issue to fix while working on this. Any thoughts on this one?

@ghandic
Copy link
Contributor Author

ghandic commented Feb 6, 2021

@tiangolo any updates on getting this merged?

Copy link
Contributor Author

@ghandic ghandic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been pending for 6 months... any update?

@ghandic
Copy link
Contributor Author

ghandic commented Apr 19, 2021

Any updates?

@ghandic
Copy link
Contributor Author

ghandic commented Sep 21, 2021

@tiangolo is there anything I can do to help this PR over the line?

@github-actions
Copy link
Contributor

📝 Docs preview for commit 232f90e at: https://630747cbd722dc6e6762a965--fastapi.netlify.app

@tiangolo tiangolo changed the title Fix to allow custom middleware HTTPExceptions to be propagated through ✨ Allow custom middlewares to raise HTTPExceptions and propagate them Aug 25, 2022
@github-actions
Copy link
Contributor

📝 Docs preview for commit 0111167 at: https://63074a20d722dc702a62a77a--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit 4a4a545 at: https://6307ecdb0d940a1b62e3859d--fastapi.netlify.app

@tiangolo
Copy link
Owner

Great, thanks @ghandic! 🚀

@tiangolo tiangolo merged commit eb3ab33 into tiangolo:master Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants