Skip to content

Commit

Permalink
Add content-length to 500 response in wsproto (#2542)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored Dec 14, 2024
1 parent a500513 commit 3575cba
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions uvicorn/protocols/websockets/wsproto_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def send_500_response(self) -> None:
headers: list[tuple[bytes, bytes]] = [
(b"content-type", b"text/plain; charset=utf-8"),
(b"connection", b"close"),
(b"content-length", b"21"),
]
output = self.conn.send(wsproto.events.RejectConnection(status_code=500, headers=headers, has_body=True))
output += self.conn.send(wsproto.events.RejectData(data=b"Internal Server Error"))
Expand Down

0 comments on commit 3575cba

Please sign in to comment.