From 0fdbb59a2a47d03c3c769c7b907c00d2c4a41f68 Mon Sep 17 00:00:00 2001 From: DenisKolodin Date: Sat, 22 Aug 2015 18:15:46 +0300 Subject: [PATCH] Map dict to headers list --- websocket/_handshake.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/websocket/_handshake.py b/websocket/_handshake.py index 4d20fed..1292523 100644 --- a/websocket/_handshake.py +++ b/websocket/_handshake.py @@ -92,8 +92,11 @@ def _get_handshake_headers(resource, host, port, options): headers.append("Sec-WebSocket-Protocol: %s" % ",".join(subprotocols)) if "header" in options: - headers.extend(options["header"]) - + header = options["header"] + if isinstance(header, dict): + header = map(": ".join, header.items()) + headers.extend(header) + cookie = options.get("cookie", None) if cookie: