You should be able to write: (GET "/:profile-page" [profile-page] ...)
Compojure (via Clout) automatically decodes parameters in the URL, so there shouldn't be any need to decode the data any further. However, for future reference, routes in Compojure have a syntax very similar to functions. So writing: (GET "/:profile-page" (codec/url-encode [profile-page])) Is similar to writing: (fn (codec/url-encode [profile-page])) You'll just get a syntax error. Instead, you need to write something like: (GET "/:profile-page" [profile-page] (let [profile-page (codex/url-encode profile-page)] ...)) - James On 10 March 2014 07:07, David Toomey <dbtoo...@gmail.com> wrote: > Thanks for the repiles -- and sorry for the delayed reply. I guess I'm > doing something obnoxiously stupid. > > The code I'm working with looks like this: > > (GET "/:profile-page" [profile-page] > ..... ;;; check if user is in database, if so, show the profile > page: )) > > I've tried several variations on the theme, but the only thing that > doesn't throw an error is this: > > (:require [ring.util.codec :as codec) > > (GET (codec/url-encode "/:profile-page") [profile-page] > > Which does not give the desired result and throws a 404. > > I tried adding it in middleware, converting the arguments to a map, stuff > like this: > > (GET (str "/:profile-page" (codec/url-encode [profile-page])) > > At this point, I'm clearly guessing and I fear I did something wrong > somewhere else. I'm still confused as to why, even after using this, the > urls do not replace any of the spaces with %20 or anything else. > > It's probably not the least bit surprising that this works without > throwing a 404, but of course, does not replace the blank spaces: > > (GET (codec/url-decode "/:profile-page") [profile-page] > > Thanks; > David > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.