This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-16
Channels
- # admin-announcements (14)
- # announcements (1)
- # aws (1)
- # beginners (105)
- # boot (609)
- # braid-chat (4)
- # braveandtrue (3)
- # cider (24)
- # cljs-dev (13)
- # cljsrn (2)
- # clojure (142)
- # clojure-berlin (7)
- # clojure-ireland (7)
- # clojure-japan (10)
- # clojure-nl (4)
- # clojure-poland (76)
- # clojure-russia (198)
- # clojure-sg (4)
- # clojure-taiwan (1)
- # clojurebridge (1)
- # clojured (4)
- # clojurescript (73)
- # conf-proposals (11)
- # cursive (10)
- # datomic (32)
- # devcards (1)
- # dirac (22)
- # editors (5)
- # emacs (3)
- # events (4)
- # funcool (19)
- # hoplon (18)
- # job (1)
- # jobs (3)
- # jobs-rus (16)
- # keechma (25)
- # ldnclj (33)
- # lein-figwheel (10)
- # leiningen (4)
- # luminus (1)
- # off-topic (19)
- # om (255)
- # onyx (51)
- # overtone (1)
- # parinfer (206)
- # perun (5)
- # proton (2)
- # re-frame (3)
- # reagent (2)
- # remote-jobs (13)
- # ring-swagger (7)
- # slack-help (4)
- # yada (7)
Hey there, I'm having some trouble regarding file upload using the ring.swagger.upload middleware. I'm trying to have a post request which takes a file and some form data, like:
(POST "/my-request" [] :return s/Str :form-params [name :- s/Str] :multipart-params [file :- upload/TempFileUpload] :middleware [upload/wrap-multipart-params] (ok (str (slurp (:tempfile file) " " name))))
but when testing the request I get an error message: {"errors":{"name":"missing-required-key"}}
when using body-params (or simply body) instead of form-params I'll get the following validaiton error: {"errors": "(not (map? nil))"}
I'm not sure if I'm missing something here or there is a problem in the ring.swagger.upload middleware, maybe someone of you could help? thanksWhen you send data with a file, all fields will be found on mulipart-params
When you send a file the content-type of request will be multipart/form-data
and all data is found in ring request map under multipart-params
key. form-params
corresponds to application/x-www-form-urlencoded
request data and body-params
to JSON/EDN/Transit/etc.
Oh okay thanks! So smth like
:multipart-params [file :- upload/TempFileUpload, name :- s/Str]
will work? thanksYes, that should work
Your browsers developer tools should allow checking the contents and headers of the requests