From 02ea5ee8cfe918d547608c69482911e3d6091290 Mon Sep 17 00:00:00 2001 From: Denis Badurina Date: Tue, 8 Jun 2021 17:24:32 +0200 Subject: [PATCH] feat(uWebSockets): Drop deprecated `request` context extra BREAKING CHANGE: The deprecated uWebSockets `request` context extra field has been dropped because it is stack allocated and cannot be used ouside the internal `upgrade` callback. --- docs/interfaces/use_uwebsockets.extra.md | 16 ---------------- docs/interfaces/use_uwebsockets.upgradedata.md | 12 ------------ src/tests/use.ts | 3 --- src/use/uWebSockets.ts | 11 +---------- 4 files changed, 1 insertion(+), 41 deletions(-) diff --git a/docs/interfaces/use_uwebsockets.extra.md b/docs/interfaces/use_uwebsockets.extra.md index 07009a17..d94bc4ac 100644 --- a/docs/interfaces/use_uwebsockets.extra.md +++ b/docs/interfaces/use_uwebsockets.extra.md @@ -17,7 +17,6 @@ The extra that will be put in the `Context`. ### Properties - [persistedRequest](use_uwebsockets.extra.md#persistedrequest) -- [request](use_uwebsockets.extra.md#request) - [socket](use_uwebsockets.extra.md#socket) ## Properties @@ -40,21 +39,6 @@ while it is accessible. ___ -### request - -• `Readonly` **request**: `HttpRequest` - -The initial HTTP request before the actual -socket and connection is established. - -**`deprecated`** uWS.HttpRequest is stack allocated and cannot be accessed outside the internal `upgrade` callback. Consider using the `persistedRequest` instead. - -#### Inherited from - -[UpgradeData](use_uwebsockets.upgradedata.md).[request](use_uwebsockets.upgradedata.md#request) - -___ - ### socket • `Readonly` **socket**: `WebSocket` & [UpgradeData](use_uwebsockets.upgradedata.md) diff --git a/docs/interfaces/use_uwebsockets.upgradedata.md b/docs/interfaces/use_uwebsockets.upgradedata.md index 70b4522b..cac08492 100644 --- a/docs/interfaces/use_uwebsockets.upgradedata.md +++ b/docs/interfaces/use_uwebsockets.upgradedata.md @@ -17,7 +17,6 @@ Data acquired during the HTTP upgrade callback from uWS. ### Properties - [persistedRequest](use_uwebsockets.upgradedata.md#persistedrequest) -- [request](use_uwebsockets.upgradedata.md#request) ## Properties @@ -32,14 +31,3 @@ uWS's request is stack allocated and cannot be accessed from outside of the internal upgrade; therefore, the persisted request holds the relevant values extracted from the uWS's request while it is accessible. - -___ - -### request - -• `Readonly` **request**: `HttpRequest` - -The initial HTTP request before the actual -socket and connection is established. - -**`deprecated`** uWS.HttpRequest is stack allocated and cannot be accessed outside the internal `upgrade` callback. Consider using the `persistedRequest` instead. diff --git a/src/tests/use.ts b/src/tests/use.ts index d955e673..41b1742b 100644 --- a/src/tests/use.ts +++ b/src/tests/use.ts @@ -90,9 +90,6 @@ for (const { tServer, startTServer } of tServers) { expect((ctx.extra as UWSExtra).socket.constructor.name).toEqual( 'uWS.WebSocket', ); - expect((ctx.extra as UWSExtra).request.constructor.name).toEqual( - 'uWS.HttpRequest', - ); expect((ctx.extra as UWSExtra).persistedRequest.method).toBe( 'get', ); diff --git a/src/use/uWebSockets.ts b/src/use/uWebSockets.ts index e6bad894..3e68d974 100644 --- a/src/use/uWebSockets.ts +++ b/src/use/uWebSockets.ts @@ -21,13 +21,6 @@ export interface Extra extends UpgradeData { * @category Server/uWebSockets */ export interface UpgradeData { - /** - * The initial HTTP request before the actual - * socket and connection is established. - * - * @deprecated uWS.HttpRequest is stack allocated and cannot be accessed outside the internal `upgrade` callback. Consider using the `persistedRequest` instead. - */ - readonly request: uWS.HttpRequest; /** * The initial HTTP upgrade request before the actual * socket and connection is established. @@ -119,7 +112,6 @@ export function makeBehavior< res.upgrade( { - request: req, persistedRequest: { method: req.getMethod(), url: req.getUrl(), @@ -169,8 +161,7 @@ export function makeBehavior< }, onMessage: (cb) => (client.handleMessage = cb), }, - { socket, request: socket.request, persistedRequest } as Extra & - Partial, + { socket, persistedRequest } as Extra & Partial, ); if (keepAlive > 0 && isFinite(keepAlive)) {