silk icon indicating copy to clipboard operation
silk copied to clipboard

ring-handler clobbers :params

Open patrickthebold opened this issue 10 years ago • 5 comments

It seems that if one uses the standard ring middle-ware 'wrap-params', that map gets lost when using ring-handler. I was thinking we could either merge the :params map provided by wrap-params with the one provided by silk, or put the silk params under a different key. Thoughts?

patrickthebold avatar Oct 05 '15 20:10 patrickthebold

The usual solution is to merge params to :params and add them under another key, e.g. :path-params, :query-params.

Deraen avatar Oct 06 '15 05:10 Deraen

Silk can extract params from the query. Are you sure you need wrap-params? wrap-params can also extract form params but that is available under the form-params which is not clobbered by Silk. If you need wrap-params, I think you should follow @Deraen's suggestion, but I would first evaluate whether you really need wrap-params.

domkm avatar Oct 07 '15 16:10 domkm

I'm using sente which requires wrap-params and wrap-keyword-params. Of course, I can work around it, but I think the "right thing to do" would be if silk didn't clobber the params. That way it would play nicer with other libraries. Would you accept a PR that merges the :params and adds the silk ones under, say, :route-params?

patrickthebold avatar Oct 08 '15 16:10 patrickthebold

Btw. wrap-params doesn't only read query string parameters but also form parameters from request body, so it's quite common to use it.

Deraen avatar Oct 08 '15 17:10 Deraen

Thanks for the clarification. I'd accept a PR that merges Silk params into the request params instead of displacing them. :)

domkm avatar Oct 09 '15 18:10 domkm