Skip to content

Commit

Permalink
Optimize concat encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Oct 26, 2021
1 parent d35854b commit c716de9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sanic/server/protocols/websocket_protocol.py
Expand Up @@ -137,9 +137,9 @@ async def websocket_handshake(
f"HTTP/1.1 {resp.status_code} {resp.reason_phrase}\r\n"
).encode()
rbody = bytearray(first_line)
rbody += b"".join(
[f"{k}: {v}\r\n".encode() for k, v in resp.headers.items()]
)
rbody += (
"".join(f"{k}: {v}\r\n" for k, v in resp.headers.items())
).encode()
rbody += b"\r\n"
if resp.body is not None:
rbody += resp.body
Expand Down

0 comments on commit c716de9

Please sign in to comment.