funcool

A channel for discussing and asking questions about Funcool libraries https://github.com/funcool/
kardan 2016-03-21T08:59:34.000143Z

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?

niwinz 2016-03-21T09:55:22.000144Z

hi @kardan

niwinz 2016-03-21T09:55:34.000145Z

Just yesterday I have thought about that

niwinz 2016-03-21T09:56:28.000146Z

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

kardan 2016-03-21T09:57:40.000147Z

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

niwinz 2016-03-21T09:57:53.000148Z

Implement if-modified-since mechanism is pretty easy

niwinz 2016-03-21T09:58:08.000149Z

but the etag seems like a little bit difficult

niwinz 2016-03-21T09:58:28.000150Z

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

kardan 2016-03-21T09:59:24.000151Z

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

niwinz 2016-03-21T10:00:28.000154Z

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

kardan 2016-03-21T10:00:45.000155Z

ah, yes

niwinz 2016-03-21T10:01:36.000156Z

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

niwinz 2016-03-21T10:01:50.000157Z

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

kardan 2016-03-21T10:02:04.000158Z

ok, cool to know.

niwinz 2016-03-21T10:04:04.000159Z

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

niwinz 2016-03-21T10:04:25.000160Z

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

kardan 2016-03-21T10:06:16.000161Z

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

kardan 2016-03-21T10:07:03.000162Z

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

niwinz 2016-03-21T10:07:12.000163Z

😉

niwinz 2016-03-21T11:05:29.000164Z

https://github.com/ratpack/ratpack/issues/941

kardan 2016-03-21T11:12:43.000166Z

👍