Fork me on GitHub

I’m trying to send a file and other data to the server using http-xhrio (re-frame wrapper around cljs-ajax) like so:

{:http-xhrio {:method          :post
                :uri             (str (endpoint) "/create-ipfs")
                :timeout         40000
                :format (ajax/json-request-format {:keywords? true})
                :response-format (ajax/json-response-format {:keywords? true})
                :multipart-params [["token-image" (:token-image db)]
                                   ["token-name" (:token-name db)]
                                   ["description" (:description db)]]           
                :on-success      [:created-ipfs]
                :on-failure      [:error-occured]}}
but on the server side, the multipart-params map is empty. How to fix that?

delaguardo10:09:45 instead of multipart-params you should use :body with js/FormData instead


Hi all, wondering if anyone can explain what :meta portion of this does exactly? I have a situation when I remove that portion I get errors in clojurescript.

(atom {} :meta {:listeners (atom {})})


The :meta sets the metadata on the atom to whatever comes after :meta , if that's what you're asking.


What error are you getting?


@U024X3V2YN4 sorry for not including. This is really a datascript thing. When I listen! I get the error if not included:

(defn listen!
  "Listen for changes on the given connection. Whenever a transaction is applied to the database via [[transact!]], the callback is called
   with the transaction report. `key` is any opaque unique value.
   Idempotent. Calling [[listen!]] with the same key twice will override old callback with the new value.
   Returns the key under which this listener is registered. See also [[unlisten!]]."
  ([conn callback] (listen! conn (rand) callback))
  ([conn key callback]
     {:pre [(conn? conn) (atom? (:listeners (meta conn)))]}
     (swap! (:listeners (meta conn)) assoc key callback)


(swap! (:listeners (meta conn)) assoc key callback)
here it is expecting that the metadata on the connection points to an atom. Thus there is a preconditien check in :pre that checks specifically for this.


I'm guessing you are getting Assert failed errors?


@U024X3V2YN4 Yes exactly. Thank you for the explanation. I thought maybe there was an idiom here outside of datascript.


The usage of metadata differ wildly from library to library. Many don't use it at all, while those that do, often use it in a library-internal way and hence having the correct metadata can become essential. Here you have a clear example of the latter.