How does ServerErrorMiddleware#__call__ send its response #2968
-
Would you please try to find a minute for an ELI5 question? I'm trying to understand the I found these related discussions but they don't touch on this issue:
Here's the permalink where the method starts: https://github.com/encode/starlette/blob/fa5355442753f794965ae1af0f87f9fec1b9a3de/starlette/middleware/errors.py#L149 I posted an excerpt of code, hope you don't mind, so I could annotate the line that I don't understand.
Am I missing something really obvious about how the response is sent? Why is the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Sure.
Correct.
Do you have the traceback?
Because a
This question makes me think that you don't understand the ASGI protocol itself. I recommend reading about it a bit, but to try to help... Every from starlette.responses import Response
app = Response(content="Hello world!", status_code=200) And run with An |
Beta Was this translation helpful? Give feedback.
Sure.
Correct.
Do you have the traceback?
Because a
Response
object is an ASGI application by itself, and to run it, you need to passscope
,receive
, andsend
.This question makes me think that you don't understand the ASGI protocol itself. I recommend reading about it a bit, but to t…