Hi Lee,

Thanks for the suggestion, will try that approach.

regards,
Jimmy

On Tuesday, April 3, 2012 4:30:10 PM UTC+1, Lee Hinman wrote:
>
> On Apr 3, 12:55 am, Jimmy <jimmy.co...@gmail.com> wrote: 
> > Hi all, 
> > 
> > The REST endpoint I need to call requires multiple boundaries in the 
> > POST request.  Does any one know how to do this in clj-http?  Lets say 
> > my header had the following boundary 
> > 
> > Content-Type    "multipart/form-data; boundary=the_message_boundary" 
> > 
> > How could i create a body with multiple boundaries such as - 
> > 
> > --the_message_boundary 
> > Content-Type: application/json 
> > {"Subject":"this is a subject", "Secure":true} 
> > 
> > --the_message_boundary 
> > Content-Type: application/json 
> > {"Recipient": "y...@you.com"]} 
> > 
> > ..etc etc 
> > 
> > Thanks, 
> > Jimmy 
>
> Would it be possible for you to create the body, and pass it in as a 
> regular :body option in the request? Or, do you need clj-http to 
> create this type of request automatically? 
>
> What about using something like this? 
>
> (defn make-body 
>   [boundary body] 
>   (str boundary "\n" 
>        "Content-Type: application/json\n" 
>        (json/encode body) "\n")) 
>
> (defn create-multi-bodies 
>   [boundry bodies] 
>   (clojure.string/join "\n" (map (partial make-body boundary) 
> bodies))) 
>
> - Lee

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