Index: sdk/lib/io/websocket_impl.dart |
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart |
index 872cd321ad7b223deadefd840311925fe9f123b8..19ebfbf532e2843392053a16f0b33869a728446c 100644 |
--- a/sdk/lib/io/websocket_impl.dart |
+++ b/sdk/lib/io/websocket_impl.dart |
@@ -769,7 +769,8 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket { |
static final HttpClient _httpClient = new HttpClient(); |
- static Future<WebSocket> connect(String url, List<String> protocols) { |
+ static Future<WebSocket> connect( |
+ String url, Iterable<String> protocols, Map<String, dynamic> headers) { |
Uri uri = Uri.parse(url); |
if (uri.scheme != "ws" && uri.scheme != "wss") { |
throw new WebSocketException("Unsupported URL scheme '${uri.scheme}'"); |
@@ -795,6 +796,9 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket { |
fragment: uri.fragment); |
return _httpClient.openUrl("GET", uri) |
.then((request) { |
+ if (headers != null) { |
+ headers.forEach((field, value) => request.headers.add(field, value)); |
+ } |
// Setup the initial handshake. |
request.headers |
..add(HttpHeaders.CONNECTION, "Upgrade") |
kustermann
2015/01/14 11:42:17
Why is this an .add() and not a .set().
If the u
Søren Gjesse
2015/01/14 13:54:26
Good catch.
|