You don't want to encode the whole URL, just the keys and values in
the query string. Something like this:

(defn encode-params [request-params]
  (let [encode #(URLEncoder/encode (str %) "UTF-8")
        coded (for [[n v] request-params] (str (encode n) "=" (encode
v)))]
    (apply str (interpose "&" coded))))





On Jun 16, 9:21 pm, Timothy Washington <twash...@gmail.com> wrote:
> Hey all, something very weird happens when trying to use the http-agent. If
> I execute a) or b) in a browser, I get the desired result XML.
> a)http://RESTful/path/to/xml
> b)http://RESTful/path/to/xml?_wrap=no&_query=declaredefault element
> namespace 'com/interrupt/bookkeeping/users';//user[ @id='one']
>
> However, using clojure, If I try the same call, d) in this case will NOT
> work.
> c) (clojure.contrib.http.agent/http-agent "http://RESTful/path/to/xml";)
>     ; works
> d) (clojure.contrib.http.agent/http-agent 
> "http://RESTful/path/to/xml?_wrap=no&_query=declaredefault element namespace
> 'com/interrupt/bookkeeping/users';//user[ @id='one']")         ; doesn't
> work
>
> I've tried url-encoding the url using the below function, but that doesn't
> help either.
> (defn url-encode [text]
>   (URLEncoder/encode text "UTF-8"))
>
> Is the something obvious I'm missing?
> Thanks

-- 
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

Reply via email to