MCPcopy
hub / github.com/encode/uvicorn / send_500_response

Method send_500_response

uvicorn/protocols/websockets/wsproto_impl.py:313–323  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

311 self.transport.close()
312
313 def send_500_response(self) -> None:
314 if self.response_started or self.handshake_complete:
315 return # we cannot send responses anymore
316 headers: list[tuple[bytes, bytes]] = [
317 (b"content-type", b"text/plain; charset=utf-8"),
318 (b"connection", b"close"),
319 (b"content-length", b"21"),
320 ]
321 output = self.conn.send(wsproto.events.RejectConnection(status_code=500, headers=headers, has_body=True))
322 output += self.conn.send(wsproto.events.RejectData(data=b"Internal Server Error"))
323 self.transport.write(output)
324
325 async def run_asgi(self) -> None:
326 try:

Callers 2

shutdownMethod · 0.95
run_asgiMethod · 0.95

Calls 2

sendMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected