Closed aiwilliams closed 6 years ago
Hi @aiwilliams
I think it's really hard to get params within the middleware.
Because the params is per endpoint variable, the params parser won't be run before the request reach the endpoint logic.
I'm sorry I think we have to match the conn.path_info
to get :app_id
and :id
manually.
Thank you for your reply. I did use the path info because it was the only approach I could see as well.
Given the following Maru 0.12.5 setup in a Phoenix 1.3.0 project:
The middleware is unable to read the
:app_id
and:id
params when a request is made toget "/:app_id/resources/:id"
. My expectation is that becauseplug MyAPI.Authenticate
is not defined in abefore
block, the plug will run after routing the request, which leads me to think I should be able to read the params after they are parsed, but before theget
block is called.How can I read the endpoint params in a plug invoked before the endpoint code?