Skip to content

Commit 8990f9c

Browse files
committed
/python-ecosys/aiohttp/aiohttp: fix header problem.
This PR will make it possible to add headers to a Websocket.
1 parent e4cf095 commit 8990f9c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python-ecosys/aiohttp/aiohttp/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def ws_connect(self, url, ssl=None):
263263
return _WSRequestContextManager(self, self._ws_connect(url, ssl=ssl))
264264

265265
async def _ws_connect(self, url, ssl=None):
266-
ws_client = WebSocketClient(None)
266+
ws_client = WebSocketClient(self._base_headers)
267267
await ws_client.connect(url, ssl=ssl, handshake_request=self.request_raw)
268268
self._reader = ws_client.reader
269269
return ClientWebSocketResponse(ws_client)

python-ecosys/aiohttp/aiohttp/aiohttp_ws.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _encode_websocket_frame(cls, opcode, payload):
136136
return frame + payload
137137

138138
async def handshake(self, uri, ssl, req):
139-
headers = {}
139+
headers = self.params
140140
_http_proto = "http" if uri.protocol != "wss" else "https"
141141
url = f"{_http_proto}://{uri.hostname}:{uri.port}{uri.path or '/'}"
142142
key = binascii.b2a_base64(bytes(random.getrandbits(8) for _ in range(16)))[:-1]

0 commit comments

Comments
 (0)