thecatalinstan / Criollo

A powerful Cocoa web framework and HTTP server for macOS, iOS and tvOS.

Home Page:https://criollo.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there any way that I cam make route path case insensitive ?

sateeshkumardamera opened this issue · comments

It seems the routes are case sensitive. how can I make them case insensitive?

I think that a more elegant way is to subclass CRHTTPServer and override (NSArray<CRRouteMatchingResult *> *)routesForPath:(NSString*)path method:(CRHTTPMethod)method

Just make the path lowercase, then call super.

Practically it would look something like this:

@interface CRHTTPServer()
- (NSArray<CRRouteMatchingResult *> *)routesForPath:(NSString*)path method:(CRHTTPMethod)method;
@end

@interface LowercaseServer : CRHTTPServer
@end

@implementation LowercaseServer

- (NSArray<CRRouteMatchingResult *> *)routesForPath:(NSString*)path method:(CRHTTPMethod)method {
    return [super routesForPath:path.lowercaseString method:method];
}

@end