This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-31
Channels
- # aleph (12)
- # announcements (4)
- # asami (7)
- # babashka (20)
- # beginners (92)
- # calva (74)
- # clj-kondo (8)
- # cljdoc (70)
- # clojure (47)
- # clojure-dev (29)
- # clojure-europe (27)
- # clojure-nl (7)
- # clojure-norway (3)
- # clojurescript (7)
- # cursive (2)
- # datomic (1)
- # emacs (8)
- # events (5)
- # fulcro (36)
- # gratitude (4)
- # humbleui (25)
- # introduce-yourself (1)
- # lsp (26)
- # malli (6)
- # missionary (8)
- # nbb (50)
- # off-topic (9)
- # pathom (2)
- # pedestal (3)
- # portal (32)
- # practicalli (5)
- # reitit (5)
- # releases (1)
- # ring (6)
- # shadow-cljs (87)
- # sql (31)
- # tools-deps (26)
- # vim (3)
- # xtdb (15)
I’m trying to get the content-type
of a string part of a multipart request. ring.middleware.multipart-params
seems to discard this for strings.
Guess I will have to parse the original request body separately to get the content-type
? (I hope the request :body
can be read more than once…?)
(`curl -F "paramName=paramValue;type=text/plain" url`)
I'm not sure what you mean by "seems to discard this for strings". The content type is passed to the store under the :content-type
key.
Ah, re-reading it I think I know what you mean. Yes, currently non-stream values don't keep the content type. I'd accept a PR to provide an additional option to change that (disabled by default so as to maintain compatibility).
Thank you @U0BKWMG5B!
What do you think about this…
• Adding :content-type
to the map on https://github.com/ring-clojure/ring/blob/8af4ab93190dfe5b4827c14b416a4cb92e18cdaf/ring-core/src/ring/middleware/multipart_params.clj#L82
• Skipping decode-string-values
when (= :bytes (:encoding options))
So if encoding is :bytes, fields wouldn’t be decoded, instead returned as maps with byte arrays and the content-type.
If this sounds OK I can send a PR.