routing-kit
routing-kit copied to clipboard
PathComponent.catchall not working as expected
I've got a simple test system with just two routes, one to return a counter structure and the other is a catch all, the counter route works fine but the catchall looks to not be called if there is a partial match to the counter route.
public func routes(_ router: Router) throws {
let version = "v1"
let counterController = CounterController()
router.get(version, "counter", String.parameter, String.parameter, use: counterController.getCounter)
router.get(PathComponent.catchall) { req in
return "Boom!"
}
}
Steps to reproduce
Testing with postman produces:
http://localhost:8080/adsd = Boom!
http://localhost:8080/v1 = { "message": "Not Found", "code": 404 }
Expected behaviour
I would expect the
http://localhost:8080/v1 = Boom!
as it doesn't match any route.
Actual behaviour
http://localhost:8080/v1 = { "message": "Not Found", "code": 404 }
Environment
- Vapor Framework version: 3.3.0
- Vapor Toolbox version: 3.1.10
- OS version: 10.14.5
I'm also having this issue, was this issue ever resolved in Vapor 3? We're only just ported our application from Vapor 2 to 3 and are not keen on porting to an Alpha release of Vapor 4.