Open cjohansen opened 7 years ago
There is not. Why would you want to do that instead of encoding them into the route itself?
I could be convinced there's a better choice. I need to add an optional value to the generated URL - the login page takes a returlUrl query parameter, but it is not required. Also, I would prefer to encode this value as a query parameter, not part of the path, as it is optional and the page is the same.
If there's already a way to do this I'm eager to hear about it. If not, I'm hopeful you'll consider making it a feature.
Generating a URL via query params does work, but not in the way @cjohansen wants.
(def routes
(silk/routes [[:foo [["bar" :herp] {"baz" :burp}]]]))
(silk/depart routes :foo {:herp "derp" :burp "kangaroo"})
;; "/bar/derp?baz=kangaroo"
@cjohansen My sincere apologies for letting this slip through. I don't recall receiving a notification of your response.
@levitanong Thanks for chiming in and drawing my attention.
Would using silk/?
provide the optional param functionality that you're looking for?
Is there any way to generate a URL for a route with some additional query parameters? I would want to do something like
(silk/depart routes :login {} {:query {"returnUrl" "/somewhere"}})
, but AFAICT there's no way to feed query params intodepart
. Am I holding it wrong?