Fork me on GitHub
#reitit
<
2022-11-16
>
whiterose08:11:48

My upload file route setup is like this:

["/upload" {:post {:parameters {:multipart {:file multipart/temp-file-part}}
                       :handler    (fn [request]
                                     (clojure.pprint/pprint request)
                                     (#'upload request))}}]
I'm trying to upload file through swagger and getting the following message:
{
  "spec": "(spec-tools.core/spec {:spec (clojure.spec.alpha/keys :req-un [:spec$20864/file]), :type :map, :leaf? false})",
  "problems": [
    {
      "path": [],
      "pred": "(clojure.core/fn [%] (clojure.core/contains? % :file))",
      "val": {},
      "via": [],
      "in": []
    }
  ],
  "type": "reitit.coercion/request-coercion",
  "coercion": "spec",
  "value": {},
  "in": [
    "request",
    "multipart-params"
  ]
}

whiterose08:11:54

It's showing the name properly. I believe it thinks the file is not present?

whiterose13:11:40

[SOLVED] Can someone help? Been stuck for couple of days. Couldn't find any related answers. 😭

aaron5113:11:50

Maybe some middleware is missing or not in the right order?

delaguardo14:11:18

you can add debug Middleware to see step by step how you request changes between Middlewares

whiterose14:11:11

Oh I didn't know there needs to be order followed. I'll try to use the debug middleware and try it again. Thanks.

whiterose14:11:32

It was the middleware placement. Thank you so much. amazed

👍 1