This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-11
Channels
- # aleph (7)
- # bangalore-clj (11)
- # boot (70)
- # cider (11)
- # cljsjs (3)
- # cljsrn (17)
- # clojure (88)
- # clojure-brasil (8)
- # clojure-dev (17)
- # clojure-greece (1)
- # clojure-italy (6)
- # clojure-poland (8)
- # clojure-russia (2)
- # clojure-spec (44)
- # clojure-uk (32)
- # clojurescript (176)
- # cloverage (2)
- # component (5)
- # cursive (3)
- # datomic (23)
- # defnpodcast (6)
- # dirac (15)
- # emacs (6)
- # garden (19)
- # hoplon (126)
- # leiningen (1)
- # off-topic (3)
- # om (66)
- # onyx (56)
- # re-frame (8)
- # reagent (7)
- # ring-swagger (43)
- # specter (18)
- # untangled (110)
- # vim (3)
- # yada (39)
@ikitommi et al, I’m having a hard time figuring out what format file uploads expect in compojure-api. The file upload example in https://github.com/metosin/compojure-api/wiki/Swagger-aware-File-uploads results in a swagger api-doc that doesn’t work.
Ok, so in my confusion I though I had tried TempFileUpload, but I was actually trying out ByteArrayUpload
https://ring-clojure.github.io/ring/ring.middleware.multipart-params.byte-array.html + wrap-multipart-params :store option
@juhoteperi I was trying to ask for a client example, but failing obviously.
Whether compojure uses tempfile or bytearray doesn't depend on client at all
"bytes=" and "file=" are the name of multipart param
:multipart-params [file :- upload/TempFileUpload]
<- file here
that could also be [foo :- upload/TempFileUpload]
, name doesn't depend on type
and you would use that as foo=@file
from curl
name is not related to if you are using byte array or temp file
ByteArrayUpload seems to expect that the is a field named bytes somewhere in the upload, but there isn't
That field is created by Ring middleware, when using byte-array store
But one sec, testing
Of course, curl is a bit limited as a client, but I was just trying to find out what is expected from the client application
https://github.com/metosin/compojure-api/commit/7b84cbeea9ba9d288a313b9450765569a08d5606
~/Source/metosin/compojure-api master*
❯ curl -X POST -F "[email protected]" localhost:3000/upload/file
{"filename":"project.clj","content-type":"application/octet-stream","size":3291}
~/Source/metosin/compojure-api master*
❯ curl -X POST -F "[email protected]" localhost:3000/upload/byte-array
{"filename":"project.clj","content-type":"application/octet-stream"}
@juhoteperi I just noticed that this is exactly what you first said. I must hang my head in shame and dribble ashes upon my person.