blackfire icon indicating copy to clipboard operation
blackfire copied to clipboard

Request.params always returns empty

Open StaticActual opened this issue 7 years ago • 2 comments

In RequestHandler.swift, the code that sets the params property of the Request object is commented out.

StaticActual avatar Mar 19 '17 21:03 StaticActual

I'll check it out, how are you formatting your request / endpoint?

elliottminns avatar Mar 20 '17 15:03 elliottminns

let app = Flame()
app.use("/api", AppRouter.getRouter())

enum AppRouter {
    public static func getRouter() -> Router {
        let router = Router()

        router.post("/documents/:id") { req, res in
            print(req.params)
            res.send(json: ["No": "Params"])
        }

        return router
    }
}

Request is just a post to that route with a random id. No matter what the id is, req.params is empty.

StaticActual avatar Mar 21 '17 16:03 StaticActual