Fork me on GitHub
#yada
<
2017-05-10
>
danielcompton00:05:06

what happens if you get rid of the vhosts model entirely and just pass the routes (for testing)

danielcompton00:05:17

to make sure that everything else is configured correctly?

nha00:05:49

good idea, I will try that tomorrow, thanks 🙂

stathissideris10:05:52

is there an easy way to get the body of a request?

dominicm10:05:54

stathissideris: is it a deferred?

dominicm10:05:05

You can probably deref it 🙂

stathissideris10:05:16

it’s a manifold.stream.BufferedStream

stathissideris10:05:29

ClassCastException manifold.stream.BufferedStream cannot be cast to java.util.concurrent.Future clojure.core/deref-future (core.clj:2206)

stathissideris10:05:39

nope, can’t deref

dominicm10:05:55

makes sense

dominicm10:05:02

it's a stream, like a java stream

stathissideris10:05:24

so interop? yuck!

dominicm10:05:30

Nope! Not quite.

dominicm10:05:47

I'm a bit confused that it is a stream, but there we are.

stathissideris10:05:56

it’s probably empty

dominicm10:05:57

There's a manifold.stream namespace for interacting with, uh, manifold streams.

stathissideris10:05:17

didn’t send a body — just testing

stathissideris10:05:37

so maybe it’s a corner case

dominicm10:05:43

(manifold.stream/take! s)
This takes off a stream ^^

dominicm10:05:03

Yada's source code might be a better example of how to consume the request body.

stathissideris10:05:17

I think I’ll switch to ring 🙂

stathissideris10:05:46

yada seems like a bit of an overkill for my use case

stathissideris10:05:01

and there’s no “gentle introduction” documentation

dominicm10:05:35

honestly: it's rare you should need to consume the request body directly @stathissideris

dominicm10:05:40

I'm confused that you are 😛

dominicm10:05:43

What's the use case?

stathissideris10:05:31

maybe I don’t need to consume the body, there’s probably a better way that I don’t know about

stathissideris10:05:50

just processing some JSON that’s coming in the body of the request

dominicm10:05:00

that's so easy in yada

dominicm10:05:03

easier than in ring 😉

dominicm10:05:27

If you have :accepts "application/json" in your resource, you will get the json body parsed & given to you as a map.

dominicm10:05:39

Under [:form :body] iirc.

stathissideris10:05:18

if only it was mentioned in the manual! 😄

stathissideris10:05:23

it’s simpler in the sense that it’s more automatic, but harder in the sense that it’s less discoverable

dominicm10:05:51

I lied, it's under :parameters in the ctx

dominicm10:05:56

yeah, the docs need some love

stathissideris10:05:14

I mean as a string

stathissideris10:05:31

slurp doesn’t work, it looks the body is something from manifold

malcolmsparks10:05:55

Built in to yada

malcolmsparks10:05:10

So it's in your project already

dominicm10:05:14

@malcolmsparks even on a manifold stream? :thinking_face:

dominicm10:05:26

but, a manifold stream is like a channel, not a byte array?