This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-23
Channels
- # admin-announcements (1)
- # announcements (1)
- # beginners (222)
- # boot (210)
- # cider (26)
- # cljs-dev (50)
- # cljsrn (19)
- # clojure (243)
- # clojure-art (12)
- # clojure-finland (1)
- # clojure-poland (43)
- # clojure-russia (46)
- # clojure-sg (13)
- # clojurescript (60)
- # core-async (14)
- # css (11)
- # datomic (9)
- # devcards (9)
- # dirac (2)
- # editors (13)
- # emacs (5)
- # euroclojure (1)
- # events (3)
- # hoplon (76)
- # immutant (10)
- # job (1)
- # jobs (2)
- # keechma (1)
- # ldnclj (33)
- # lein-figwheel (1)
- # leiningen (20)
- # luminus (26)
- # mount (31)
- # om (105)
- # onyx (56)
- # parinfer (29)
- # perun (12)
- # proton (1)
- # re-frame (14)
- # reagent (5)
- # sydney (1)
- # yada (15)
Is anyone aware of an issue with clj-http and including file attachments in a POST? I realize this isn't a clj-http group, but I couldn't think of a better one...I'm trying to send an email w/ attachment through the Mailgun API, and the email goes through fine but the attachment has vanished.
@eggsyntax: I've done a bit of work with mailgun in the past. Perhaps you're missing the proper http post content type? See http://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
@mikeb: I'm definitely specifying content type. I've tried quite a few variants, but I'm doing roughly:
(client/post (url ["messages"])
{:to test-address
:from from
:subject "TEST 6"
:text "So funny such banana, wow"
:multipart [{:name "title" :content "My Awesome Picture"}
{:name "Content/type" :content "image/jpeg"}
{:name "file"
:content (FileBody.
( "resources/banana.jpg"))}]
:basic-auth ["api" api-key]})
Or, hmm, maybe what that's saying isn't about content type of the attachment, but about the whole post? I'll have to look into that more.
I was thinking of the whole post. Perhaps it detects that automatically because it's got parts.
Gotcha. I'm not sure. I'm looking at the examples in the clj-http docs (https://github.com/dakrone/clj-http#post) for guidance and trying to reconcile that with mailgun's expectations (per https://documentation.mailgun.com/user_manual.html#sending-via-api).
Are those content types specifically for MIME representations? That's also not quite clear to me, whether clj-http is producing a MIME representation or not.
I started digging into the clj-http source code a while ago, & will probably dig back in tomorrow morning, it seems promising. But I gotta run to bed now. Thanks for the help!
Didn't get nearly enough sleep last night, gotta try to make up for it tonight 😉
@eggsyntax: yeah, that clj-http file upload api and mailgun are not playing well at all.
@mikeb: thanks! I’m glad to have independent confirmation. I sure had trouble getting it to work, but it was entirely possible that I was doing something silly.
@jbaiter Looking at the figwheel docs for component, it might be the other way around: mount/start would need to set up figwheel. See https://github.com/bhauman/lein-figwheel#scripting-with-component
@jbaiter you might also ask this in #C0H7M5HFE
@curtis.summers: thanks, I hoped there was an easier way "lein figwheel" is just so damn convenient
@jbaiter: I don't know figwheel well enough, but can you have (mount/start)
in one your cljs files? or there is a reason you need it to start with figwheel?
for the server side, I tend to use lein run
to start up the server part in addition to running lein figwheel