Cro: libraries and tools for building reactive services in Perl 6 | cro.services/ | Logs: irclog.perlgeek.de/cro/
Set by moderator on 28 January 2018.
japhb Glad I could help, colomon. :-) 00:31
colomon I’ve actually made a ton of progress since then. Nothing too fancy, but I’ve got about half of a handy internal $work tool up and running now 00:32
02:59 ilbot3 joined
moderator Cro: libraries and tools for building reactive services in Perl 6 | cro.services/ | Logs: irclog.perlgeek.de/cro/
japhb Sweet! 05:05
07:17 sena_kun joined 13:40 lizmat joined
Geth cro-core: a4fdbd5a1a | (Jonathan Worthington)++ | 3 files
Add a Cro::MessageWithBody role

This role will factor out various common bits of body parsing logic that have started to spread across Cro (HTTP, WebSocket, ZeroMQ). As well as lifting out some duplicate code, this will provide a more predictable API across Cro. As a first step, this just lifts the
  `body-blob` method out into the role.
15:21
cro-http/push-promise: c58fcd143b | (Jonathan Worthington)++ | lib/Cro/HTTP/Message.pm6
Use Cro::MessageWithBody role in HTTP messages

This means the `body-blob` method is no longer needed in this class.
15:23
cro-websocket: 51b896fdd7 | (Jonathan Worthington)++ | lib/Cro/WebSocket/Message.pm6
Use Cro::MessageWithBody in websocket messages

The role factors out the `body-blob` method, which can now be removed.
15:27
sena_kun jnthn, why not into master(cro-http)? :) 15:29
jnthn oh, didn't notice what branch I was on :/
Geth cro-http: 8fb60eed47 | (Jonathan Worthington)++ | lib/Cro/HTTP/Message.pm6
Use Cro::MessageWithBody role in HTTP messages

This means the `body-blob` method is no longer needed in this class.
15:30
jnthn Thanks
sena_kun np
Geth cro-core: d97cc6feba | (Jonathan Worthington)++ | 2 files
Add `body-text` method to Cro::MessageWithBody

This requires that any messages that want to support textual bodies implement a `body-text-encoding` method that returns an encoding or Iterable of encodings to try. It takes care of applying those.
16:03
cro-http: 4bfc1ace39 | (Jonathan Worthington)++ | lib/Cro/HTTP/Message.pm6
Use body-text from Cro::MessageWithBody

This means we just need to retain the encoding detection logic in the HTTP message.
16:04
cro-http: b15210fec9 | (Jonathan Worthington)++ | META6.json
Add missing META6.json entry
16:14
cro-websocket: 8df9f38637 | (Jonathan Worthington)++ | 2 files
Correct tests trying to body-text non-text message

It's fairly likely that anyone trying to obtain the body text of a message that is not Text, but rather binary data, is confused. This wishes it to throw instead.
16:22
cro-websocket: cb0d4e5bcf | (Jonathan Worthington)++ | lib/Cro/WebSocket/Message.pm6
Use body-text from Cro::MessageWithBody

By implementing the body-text-encoding method.
jnthn I've been looking at the Cro::HTTP::BodyParserSelector, Cro::HTTP::BodyParser, a few implementations of the former, and the related set of serialization classes. 16:35
They don't actually have anything HTTP-specific about them really
So considering lifting those up to Cro:: level (and in Cro::Core), which in turn allows method body to neatly move to the Cro::MessageWithBody role
That gets a lot of re-use that we can do for, say, web socket message processing. 16:36
So that if you wanted to, you could set things up so that JSON parsing and serialization of websocket messages is done automatically, and you just get it with .body or so 16:37
Just like with HTTP messages 16:38
Will have a go at that tomorrow. I doubt many (any?) folks have custom body parsers/serializers yet. 16:39