From 20217564e033ce57b6ceb59e0a6c6be9ad7860d3 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 3 Mar 2018 14:06:46 +0000 Subject: allow both POST and GET --- lib/Ultramarine/Controller.pm6 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/Ultramarine/Controller.pm6 b/lib/Ultramarine/Controller.pm6 index f5cbd64..5e18b48 100644 --- a/lib/Ultramarine/Controller.pm6 +++ b/lib/Ultramarine/Controller.pm6 @@ -51,8 +51,11 @@ class Ultramarine::Controller { # middlewares, so our serialised won't be seen by the # "unauthorised" response before $!authorisation; - post -> 'ping' { respond [] } - post -> 'getLicense' { + + post my $ping = -> 'ping' { respond [] } + get $ping; + + post my $getLicense = -> 'getLicense' { my $expires = $.license.expires-at.DateTime.truncated-to('second'); respond [ :status, @@ -63,7 +66,9 @@ class Ultramarine::Controller { ], ], } - post -> 'getMusicFolders' { + get $getLicense; + + post my $getMusicFolders = -> 'getMusicFolders' { respond [ :status, musicFolders => [ @@ -71,8 +76,9 @@ class Ultramarine::Controller { ] ], } + get $getMusicFolders; # this is clearly not a Subsonic method - post -> 'dakkarList' { + get -> 'dakkarList' { await $.collection.is-ready; respond [ :status, -- cgit v1.2.3