Fix undefined forEach error in tiny test

This commit is contained in:
Jan Dvorak
2021-05-26 23:00:49 +02:00
parent 7ecb11d796
commit ffdac61282
2 changed files with 5 additions and 4 deletions

View File

@@ -1,5 +1,3 @@
var url = Npm.require('url');
// By default, we use the permessage-deflate extension with default
// configuration. If $SERVER_WEBSOCKET_COMPRESSION is set, then it must be valid
// JSON. If it represents a falsey value, then we do not use permessage-deflate
@@ -154,7 +152,7 @@ Object.assign(StreamServer.prototype, {
// (meaning prior to any connect middlewares) so we need to take
// an approach similar to overshadowListeners in
// https://github.com/sockjs/sockjs-node/blob/cf820c55af6a9953e16558555a31decea554f70e/src/utils.coffee
['request', 'upgrade'].forEach(function(event) {
['request', 'upgrade'].forEach((event) => {
var httpServer = WebApp.httpServer;
var oldHttpServerListeners = httpServer.listeners(event).slice(0);
httpServer.removeAllListeners(event);
@@ -165,6 +163,9 @@ Object.assign(StreamServer.prototype, {
// Store arguments for use within the closure below
var args = arguments;
// TODO replace with url package
var url = Npm.require('url');
// Rewrite /websocket and /websocket/ urls to /sockjs/websocket while
// preserving query string.
var parsedUrl = url.parse(request.url);

View File

@@ -81,7 +81,7 @@ Meteor.methods({
'tinytest/clearResults'(runId) {
check(runId, String);
handlesForRun.get(runId).forEach(handle => {
handlesForRun.get(runId)?.forEach(handle => {
// XXX this doesn't actually notify the client that it has been
// unsubscribed.
handle.stop();