Fork me on GitHub
#yada
<
2015-11-11
>
tangrammer11:11:46

do you have experience setting/retrieving cookies with yada?

stijn14:11:46

@imre: I did something similar, but not with a protocol. Just a function that I call at the end of the POST method

stijn14:11:55

as long as you return a Response it wil interpret it correctly

stijn14:11:10

@tangrammer: we're using tokens for API authentication. it does session expiration though, but not with cookies

tangrammer14:11:44

@stijn: thanks for your comment! Maybe my question is a more generic one: which is the better way/place to add a header to the response?

tangrammer14:11:56

so far my only way is using/impl interpret-post-result from PostResult protocol

stijn14:11:54

you can return from POST

(-> ctx :response (update :headers assoc "X-Some-Header" "a very secure token"))

stijn14:11:24

yada will interpret Response properly

stijn14:11:37

it does not recognize a map currently, but you can use Response as your map

tangrammer16:11:27

@stijn: great, thanks!

imre16:11:12

@stijn: I did try retutning a Response from POST but could not get through that way. What I found is that the sophisticated response formatting that's present in GetMethod is missing from PostMethod

imre16:11:53

so I copied and added them to the end of interpret-post-result

malcolmsparks17:11:11

good to know, I'm still working on async streaming POST/PUT but almost done - happy to fix up interpret-post-result to match GETs

imre17:11:26

@malcolmsparks it's what happens right after interpret- that is different

imre17:11:36

I'm happy with where I ended up however, it's nice to have all those extension points

imre17:11:36

Thought of submitting a pull req but I don't know the http standard well enough to know that I'm not going against it by returning all sorts of data from a post

imre17:11:24

One thng that I will probably submit though if no one does is edn arsing from the request bdy

imre17:11:38

Parsing I mean

imre17:11:36

Again, nice to have been able to implement it with a defmethod, one more yay to good ext points