From db883a7201d57025a577f5973c8ab936c51fed21 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 16 Dec 2017 20:38:49 +0000 Subject: also JSON serialiser Subsonic's JSON response structure is just different enough from what XML::Writer wants, that making them both work is going to be *hard* --- lib/Ultramarine/Serialiser/JSON.pm6 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/Ultramarine/Serialiser/JSON.pm6 diff --git a/lib/Ultramarine/Serialiser/JSON.pm6 b/lib/Ultramarine/Serialiser/JSON.pm6 new file mode 100644 index 0000000..3928dc8 --- /dev/null +++ b/lib/Ultramarine/Serialiser/JSON.pm6 @@ -0,0 +1,16 @@ +use v6.d.PREVIEW; +use Cro::HTTP::BodySerializer; +use XML::Writer; + +class Ultramarine::Serialiser::JSON + is Cro::HTTP::BodySerializer::JSON { + + method serialize(Cro::HTTP::Message $message, $body --> Supply) { + nextwith $message, { + subsonic-response => { + :version<1.13.0>, + |$body, + }, + }; + } +} -- cgit v1.2.3