From 4f211f88a98592cc2cc24bf181deca5e85d6477f Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sun, 25 Feb 2024 20:27:18 +0100 Subject: [PATCH] fix(ws): resolve pathname for matching --- src/app.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index c3733348..5064bc99 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,4 +1,4 @@ -import { joinURL, withoutTrailingSlash } from "ufo"; +import { hasProtocol, joinURL, parseURL, withoutTrailingSlash } from "ufo"; import type { AdapterOptions as WSOptions } from "crossws"; import { lazyEventHandler, @@ -343,7 +343,8 @@ function websocketOptions( return { ...appOptions.websocket, async resolve(info) { - const resolved = await evResolver(info.url); + const { pathname } = parseURL(info.url || "/"); + const resolved = await evResolver(pathname); return resolved?.handler?.__websocket__ || {}; }, };