Fork me on GitHub
#reitit
<
2020-08-07
>
delaguardo15:08:45

Hi, in the context of reitit-ring — is it possible to get raw body after coercion happen? Right now I’m getting empty InputStream. Looks like it was read by coercer and left empty (

firstclassfunc15:08:56

Morning is there anyway to use ring/create-file-handler to list a directory contents? these directories are dynamically created to don't know a priori. thanks

ikitommi17:08:56

@delaguardo InputStreams can only read once. In default stack, Muuntaja reads it. The current coercion impls don't publish it, except malli, but only for errors. Here's the code: https://github.com/metosin/reitit/blob/master/modules/reitit-malli/src/reitit/coercion/malli.cljc#L65

ikitommi17:08:27

Should the coercion have an option to publish the coerced value?

delaguardo17:08:45

It could be helpful in many scenarios. My, for instance, is to coerce body and then check the signature of original message

delaguardo17:08:41

But I need to have original data intact to reconstruct it's signature

ikitommi17:08:16

original value is not deleted, for body it's in :body-params

ikitommi17:08:25

original as in before-coerced.

ikitommi17:08:29

@gary001 nothing in reitit, but if there is any ring-compatible lib doing that, you can use it.

tom20:08:02

Looking at this: https://www.metosin.fi/blog/reitit020/ uploading makes sense when you have {:parameters {:file multipart/temp-file-part}} but what happens when you have additional form fields being submitted? If I try this I get coercion exceptions. Additionally my formdata library is adding an index to the file. Instead of file is it submitting as file[0]but that should not matter right?

tom20:08:43

I think I figured out the first part. The second part with file[0] still confuses me about how to label that with data-spec. Also, can reitit reload the search on code changes like lein ring server did?