Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
06:36 Xliff_ joined 06:39 Xliff left 10:56 sena_kun joined 12:14 sena_kun left 12:15 sena_kun joined, sena_kun left 12:19 sena_kun joined 14:27 sena_kun left 15:00 sena_kun joined 15:01 sena_kun left 17:15 sena_kun joined 17:36 TheAthlete joined 18:06 sena_kun left 18:08 sena_kun joined
lizmat I'm considering writing a module that would act as a server, and the only thing it would do is to capture raw requests (header + body) and store them in a "temp" directory 19:40
and return a 200 OK
the reason for this is for de-coupling of webhooks from their processing
e.g. to be able to re-run a webhook again locally if something died processing the webhook contents 19:41
or to be able to upgrade webhook handling without losing webhook events 19:42
my question: does it make sense to use Cro::HTTP::Server for this? and if so, to use Cro::HTTP::Router for this as well ? 19:43
it feels that Cro::HTTP::Server should be enough by itself
anything not POST should just be some non-200 code 19:44
anything POST should be OK
no decoding, just dumping whatever was received as binary 19:45
or is there something like that already ?
22:02 TheAthlete left
jnthnwrthngtn lizmat: Maybe 204 No Content is even more appropriate. But yeah, you could get away with any `route` and write a Cro::Transform directly, although it's hardly a lift to write a route block that swallos every POST as you want and probably less code 22:07
route { post -> *@ { request-body-blob -> $blob { #`( then write out headers and the body blob ) } } 22:08
Note that `request.Str` will get you the serialized HTTP request line and headers 22:09
So it's really easy :)
lizmat ok, I was getting to that realization... at least it would allow for https:// support out of the box as well
jnthnwrthngtn Unless you need to be so close to the wire that you care about retaining, say, chunked transfer encoding or on-the-wire compression 22:10
lizmat no, I don't :-)
jnthnwrthngtn Figured not from the problem description :)
lizmat ok, Cro::Webhook, here we come :-)
jnthnwrthngtn Have fun :) 22:14
lizmat will try so :-)