From 590801e733e5cedd831a04497731059b56c11c4e Mon Sep 17 00:00:00 2001 From: Javad Zobeidi Date: Tue, 28 May 2024 21:52:36 +0330 Subject: [PATCH] Fixed route path bug --- lib/src/route/route_handler.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/route/route_handler.dart b/lib/src/route/route_handler.dart index 77f10fe..3cb81ae 100644 --- a/lib/src/route/route_handler.dart +++ b/lib/src/route/route_handler.dart @@ -9,7 +9,7 @@ import 'package:vania/src/utils/functions.dart'; Future httpRouteHandler(HttpRequest req) async { final route = _getMatchRoute( - req.uri.path, + req.uri.path.toLowerCase(), req.method, req.headers.value(HttpHeaders.hostHeader), ); @@ -21,7 +21,7 @@ Future httpRouteHandler(HttpRequest req) async { } else { final isFile = await setStaticPath(req); if (isFile == null) { - if (req.headers.contentType.toString() == "application/json") { + if (req.headers.contentType.toString().contains("application/json")) { throw NotFoundException(message: {'message': 'Not found'}); } else { throw NotFoundException(); @@ -45,8 +45,8 @@ RouteData? _getMatchRoute(String inputRoute, String method, String? domain) { RouteData? matchRoute; for (RouteData route in methodMatchedRoutes) { - route.path = sanitizeRoutePath(route.path); - inputRoute = sanitizeRoutePath(inputRoute); + route.path = sanitizeRoutePath(route.path.toLowerCase()); + inputRoute = sanitizeRoutePath(inputRoute.toLowerCase()); String routePath = route.path.trim(); if (route.prefix != null) {