On Apr 3, 12:55 am, Jimmy <[email protected]> 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": "[email protected]"]}
>
> ..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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en