Http.swift icon indicating copy to clipboard operation
Http.swift copied to clipboard

Cannot intercept all routes

Open JanHalozan opened this issue 4 years ago • 2 comments

Trying to intercept all routes:

server.get("/.*") { req -> Response in
    return Response.ok("Got it")
}

doesn't work. Seems to be a bug in Regex L23: (1..<result.numberOfRanges).forEach { should it start with 0?

JanHalozan avatar Apr 29 '20 08:04 JanHalozan

Did you try following?

server.get("/{rest}") { req in
    return Response.ok("Got it")
}

OrkhanAlikhanov avatar Apr 29 '20 14:04 OrkhanAlikhanov

But that's just a workaround. The regex should in theory catch everything but it doesn't.

JanHalozan avatar Apr 30 '20 18:04 JanHalozan