Fork me on GitHub
#funcool
<
2016-03-21
>
kardan08:03:34

So playing a bit with Catacumba, how would one go for implementing something like etags? Just calculate in the ending handler and add to response? Guess there is no way to hook in a function after the ending handler on the “way back”? Or am I missing something?

niwinz09:03:34

Just yesterday I have thought about that

niwinz09:03:28

I want implement http cache mechanism in my app and I found the same issue

kardan09:03:40

I don’t need it at the moment, was mostly trying to chew on the model a bit

niwinz09:03:53

Implement if-modified-since mechanism is pretty easy

niwinz09:03:08

but the etag seems like a little bit difficult

niwinz09:03:28

I think ratpack does not provides any way to do it, but I think we can do it at catacumba level

kardan09:03:24

let [resp (do stuff) etag (calculate-etag resp)] (http/ok resp {:etag etag}) ?

niwinz10:03:28

yes, but this only calculates the etag, we also need a mechainism for "no send the response in case of request etag matches the response etag

niwinz10:03:36

At this moment it is not possible implement, but I'm thinking on it. I would like to have it plugable

niwinz10:03:50

in the same way as I also working on content-negotiation

kardan10:03:04

ok, cool to know.

niwinz10:03:04

Ratpack provides a beforeSend handler but I think it does not allows overwrite the body

niwinz10:03:25

I think I can make a feature proposal for allow overwrite the body on that hook

kardan10:03:16

Well as I said. I don’t really have a usecase for etags. What I build is really early at this point

kardan10:03:03

I don’t have a problem witch cache and etags - but I hope I’ll get one simple_smile