ring-mock icon indicating copy to clipboard operation
ring-mock copied to clipboard

Add support for mocking multipart uploads

Open hoxu opened this issue 4 years ago • 0 comments

A built-in support for mocking multipart uploads would be nice.

In #9, @danielcompton gives a workaround using Peridot's peridot.multipart/build:

(-> (ring.mock.request/request :post "/my-file-upload")
    (merge (peridot.multipart/build {:data (io/file (io/resource "data.csv"))}))
    (app))

Peridot's implementation uses org.apache.httpcomponents/httpmime.

Maybe a similar function signature like (ring.mock.request/multipart request map) could be used, where the map keys would be strings and values could be either strings or files.

hoxu avatar Sep 26 '21 16:09 hoxu