Index: tools/testing/dart/http_server.dart |
diff --git a/tools/testing/dart/http_server.dart b/tools/testing/dart/http_server.dart |
index 7f5fae75bc4dee64baf58831ba2bf50a50a5af10..843aaafe9be59ed0fed6c6e78cba3746325d19dc 100644 |
--- a/tools/testing/dart/http_server.dart |
+++ b/tools/testing/dart/http_server.dart |
@@ -260,7 +260,13 @@ class TestingServers { |
websocket.done.catchError((_) {}); |
websocket.listen((data) { |
websocket.add(data); |
- websocket.close(); |
+ if (data == 'close-with-error') { |
+ // Note: according to the web-sockets spec, a reason longer than 123 |
+ // bytes will produce a SyntaxError on the client. |
+ websocket.close(WebSocketStatus.UNSUPPORTED_DATA, 'X' * 124); |
+ } else { |
+ websocket.close(); |
+ } |
}, onError: (e) { |
DebugLogger.warning('HttpServer: error while echoing to WebSocket', e); |
}); |