Fork me on GitHub
#yada
<
2017-05-08
>
danielcompton19:05:40

Does anyone have an example of coercing an upload to a file? I tried putting :post {:parameters {:body java.io.File}}, but got a 400 back. A second probably related question, why would (:body ctx) have the body of my file, but (:request (:body ctx)) have an empty stream?

danielcompton20:05:48

It looks like https://github.com/juxt/yada/blob/1.2.2/src/yada/request_body.clj#L42-L56 isn't fully implemented yet. It looks like it just counts the number of buffers in the body-stream? Is that correct or am I misreading it?

devo20:05:33

How do I get a cookie from within a resource method? (get-in ctx [:cookies]) works for the verify multimethods but returning nil on ctx in a resource method.

devo21:05:26

Doesn't look like there is a :cookies anywhere in the request map.

devo22:05:22

danielcompton: Also having issues getting this to work. All I can glean from the yada source is that (s/optional-key :cookie) s/Any is an accepted resource parameter but not where it is coerced or the correct format for a resource entry, as :parameters {:cookie {(schema/required-key "session") String}} doesn't seem to pull in the cookie or require anything as a parameter.

danielcompton22:05:27

hmm, not sure, I've never used it I just saw it going through the code base. Maybe see if there's any tests for it?

devo23:05:24

alrighty

danielcompton21:05:51

like a form param

devo21:05:31

oh nice. thanks!