@@ -2466,12 +2466,12 @@ export function createStaticHandler(
24662466 { requestContext } : { requestContext ?: unknown } = { }
24672467 ) : Promise < StaticHandlerContext | Response > {
24682468 let url = new URL ( request . url ) ;
2469- let method = request . method . toLowerCase ( ) ;
2469+ let method = request . method ;
24702470 let location = createLocation ( "" , createPath ( url ) , null , "default" ) ;
24712471 let matches = matchRoutes ( dataRoutes , location , basename ) ;
24722472
24732473 // SSR supports HEAD requests while SPA doesn't
2474- if ( ! isValidMethod ( method ) && method . toUpperCase ( ) !== "HEAD" ) {
2474+ if ( ! isValidMethod ( method ) && method !== "HEAD" ) {
24752475 let error = getInternalRouterError ( 405 , { method } ) ;
24762476 let { matches : methodNotAllowedMatches , route } =
24772477 getShortCircuitMatches ( dataRoutes ) ;
@@ -2548,15 +2548,12 @@ export function createStaticHandler(
25482548 } : { requestContext ?: unknown ; routeId ?: string } = { }
25492549 ) : Promise < any > {
25502550 let url = new URL ( request . url ) ;
2551- let method = request . method . toLowerCase ( ) ;
2551+ let method = request . method ;
25522552 let location = createLocation ( "" , createPath ( url ) , null , "default" ) ;
25532553 let matches = matchRoutes ( dataRoutes , location , basename ) ;
25542554
25552555 // SSR supports HEAD requests while SPA doesn't
2556- if (
2557- ! isValidMethod ( method ) &&
2558- ! [ "HEAD" , "OPTIONS" ] . includes ( method . toUpperCase ( ) )
2559- ) {
2556+ if ( ! isValidMethod ( method ) && method !== "HEAD" && method !== "OPTIONS" ) {
25602557 throw getInternalRouterError ( 405 , { method } ) ;
25612558 } else if ( ! matches ) {
25622559 throw getInternalRouterError ( 404 , { pathname : location . pathname } ) ;
0 commit comments