@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/changelog.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  # Change Log
4
4
 
5
- ## 0.5.0-beta (Unreleased)
5
+ ## 0.5.2-beta (2025-07-15)
6
+
7
+ ### Fixed
8
+
9
+ - upgrade request detection
10
+
11
+ ## 0.5.1-beta (2025-07-15)
12
+
13
+ ### Changed
14
+
15
+ - upgrade request log message
16
+
17
+ ## 0.5.0-beta (2025-07-04)
6
18
 
7
19
  ### Changed
8
20
 
package/dist/index.cjs CHANGED
@@ -2534,7 +2534,7 @@ function createListener(storage, middleware, routes3, onSocketError) {
2534
2534
  }
2535
2535
  });
2536
2536
  if (route) {
2537
- if (request.method === "GET" && request.headers.one("connection") === "Upgrade" && request.headers.one("upgrade")?.toLowerCase() === "websocket") {
2537
+ if (request.method === "GET" && request._req["upgrade"] && request.headers.one("upgrade")?.toLowerCase() === "websocket") {
2538
2538
  const socket = request.socket;
2539
2539
  const host = request.host;
2540
2540
  const info = socketKey(request._req.socket);
@@ -2567,6 +2567,9 @@ function createListener(storage, middleware, routes3, onSocketError) {
2567
2567
  socket.destroy();
2568
2568
  }
2569
2569
  } else {
2570
+ if (logger7.enabledFor("debug")) {
2571
+ logger7.debug(`rejecting request for ${path} with method ${request.method} from ${request.socket.remoteAddress}:${request.socket.remotePort} with headers: ${JSON.stringify(request._req.rawHeaders)}`);
2572
+ }
2570
2573
  response.statusCode = 426;
2571
2574
  response._res.appendHeader("Upgrade", "websocket").appendHeader("Connection", "Upgrade").appendHeader("Content-Type", "text/plain");
2572
2575
  await response.end(`This service [${request.path}] requires use of the websocket protocol.`);