@interopio/gateway-server 0.5.0-beta → 0.5.2-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2503,7 +2503,7 @@ function createListener(storage, middleware, routes3, onSocketError) {
2503
2503
  }
2504
2504
  });
2505
2505
  if (route) {
2506
- if (request.method === "GET" && request.headers.one("connection") === "Upgrade" && request.headers.one("upgrade")?.toLowerCase() === "websocket") {
2506
+ if (request.method === "GET" && request._req["upgrade"] && request.headers.one("upgrade")?.toLowerCase() === "websocket") {
2507
2507
  const socket = request.socket;
2508
2508
  const host = request.host;
2509
2509
  const info = socketKey(request._req.socket);
@@ -2536,6 +2536,9 @@ function createListener(storage, middleware, routes3, onSocketError) {
2536
2536
  socket.destroy();
2537
2537
  }
2538
2538
  } else {
2539
+ if (logger7.enabledFor("debug")) {
2540
+ logger7.debug(`rejecting request for ${path} with method ${request.method} from ${request.socket.remoteAddress}:${request.socket.remotePort} with headers: ${JSON.stringify(request._req.rawHeaders)}`);
2541
+ }
2539
2542
  response.statusCode = 426;
2540
2543
  response._res.appendHeader("Upgrade", "websocket").appendHeader("Connection", "Upgrade").appendHeader("Content-Type", "text/plain");
2541
2544
  await response.end(`This service [${request.path}] requires use of the websocket protocol.`);