fix subprotocol for granian
This commit is contained in:
parent
709c6dedf2
commit
ed3955a59a
@ -419,11 +419,12 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
if (
|
if (
|
||||||
message["type"] == "websocket.accept"
|
message["type"] == "websocket.accept"
|
||||||
and protocol_key in headers
|
and protocol_key in headers
|
||||||
|
and isinstance(
|
||||||
|
(subprotocol := headers[protocol_key]), bytes
|
||||||
|
)
|
||||||
):
|
):
|
||||||
message["headers"] = [
|
message["subprotocol"] = subprotocol.decode()
|
||||||
*message.get("headers", []),
|
|
||||||
(b"sec-websocket-protocol", headers[protocol_key]),
|
|
||||||
]
|
|
||||||
return await original_send(message)
|
return await original_send(message)
|
||||||
|
|
||||||
return await self.app(scope, receive, modified_send)
|
return await self.app(scope, receive, modified_send)
|
||||||
|
Loading…
Reference in New Issue
Block a user