Skip to content

Commit

Permalink
Merge pull request #67 from javad-zobeidi/dev
Browse files Browse the repository at this point in the history
Fixed route path bug
  • Loading branch information
javad-zobeidi committed May 28, 2024
2 parents c6827a8 + 590801e commit 80b32bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/src/route/route_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:vania/src/utils/functions.dart';

Future<RouteData?> httpRouteHandler(HttpRequest req) async {
final route = _getMatchRoute(
req.uri.path,
req.uri.path.toLowerCase(),
req.method,
req.headers.value(HttpHeaders.hostHeader),
);
Expand All @@ -21,7 +21,7 @@ Future<RouteData?> 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();
Expand All @@ -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) {
Expand Down

0 comments on commit 80b32bf

Please sign in to comment.