From 592264b623852cf7d9a52d4df84a43c26369d75b Mon Sep 17 00:00:00 2001 From: Birkhoff Lee Date: Sun, 6 Mar 2022 13:09:09 +0800 Subject: [PATCH] fix: request.connection deprecation This commit reorders the client IP gathering process, prioritising `request.socket` to be accessed before `request.connection`, which is now a deprecated object. --- src/request.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/request.ts b/src/request.ts index e426468..7d569a2 100644 --- a/src/request.ts +++ b/src/request.ts @@ -29,8 +29,8 @@ export class Request extends InteractsWithHeaders { */ getClientIp (): string | undefined { return this.fromHeaders() ?? - this.fromConnection() ?? this.fromSocket() ?? + this.fromConnection() ?? this.fromInfo() ?? this.fromRaw() ?? this.fromRequestContext()