File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 11import type { H3EventContext } from "../types" ;
22import type { NodeIncomingMessage , NodeServerResponse } from "../node" ;
3- import { MIMES , sanitizeStatusCode , sanitizeStatusMessage } from "../utils" ;
3+ import {
4+ MIMES ,
5+ sanitizeStatusCode ,
6+ sanitizeStatusMessage ,
7+ getRequestPath ,
8+ } from "../utils" ;
49import { H3Response } from "./response" ;
510
611export interface NodeEventContext {
@@ -18,7 +23,7 @@ export class H3Event implements Pick<FetchEvent, "respondWith"> {
1823 }
1924
2025 get path ( ) {
21- return this . req . url ;
26+ return getRequestPath ( this ) ;
2227 }
2328
2429 /** @deprecated Please use `event.node.req` instead. **/
Original file line number Diff line number Diff line change @@ -113,8 +113,8 @@ export function getRequestProtocol(
113113
114114const DOUBLE_SLASH_RE = / [ / \\ ] { 2 , } / g;
115115
116- export function getRequestPath ( event : H3Event ) {
117- const path = ( event . path || "/" ) . replace ( DOUBLE_SLASH_RE , "/" ) ;
116+ export function getRequestPath ( event : H3Event ) : string {
117+ const path = ( event . node . req . url || "/" ) . replace ( DOUBLE_SLASH_RE , "/" ) ;
118118 return path ;
119119}
120120
You can’t perform that action at this time.
0 commit comments