clj-http 2020-04-15

How to upload multipart params? When I do

(deftest ^:integration upload-csv-test
  (is (= (http/post ""
                    [{:multipart {:name "file" :content (io/file (io/resource "valid.csv"))}}])
         nil)))
I get error: java.lang.IllegalArgumentException: Key must be integer

@erwinrooijakkers you need to unwrap the outer vector and pass the arguments to :multipart in a vector

Oh thanks, yes I had that, different error 🙂:

(deftest ^:integration upload-csv-test
  (is (= (http/post ""
                    {:multipart [{:name "file" :content (io/file (io/resource "valid.csv"))}]})
         nil)))

;; => error: java.lang.Exception: Multipart content cannot be nil

this indicates that (io/resource "valid.csv") returned nil

I see

Okay I get another 500 now

When running from cider test/resources are not included

Thanks now I get the error from the application itself 🙂

Works