From 2f440817c4a0a1529766a66181920e9d0bf0209f Mon Sep 17 00:00:00 2001 From: swaggboi Date: Tue, 31 Oct 2023 21:54:43 -0400 Subject: [PATCH] Use static types to troubleshoot the Libarchive/POST body thing... --- lib/Hyperlink-Redirect.rakumod | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Hyperlink-Redirect.rakumod b/lib/Hyperlink-Redirect.rakumod index 06e7d32..6bf09e5 100644 --- a/lib/Hyperlink-Redirect.rakumod +++ b/lib/Hyperlink-Redirect.rakumod @@ -24,19 +24,19 @@ $router.get(-> $request, $response { }); $router.post(-> $request, $response { - my $return-url = $request.content.{'hyperlink'}; - my $url-scheme = $request.headers.{'X-Forwarded-Proto'} || 'http'; - my $url-host = $request.headers.{'Host'}; - my $base-url = $url-scheme ~ '://' ~ $url-host ~ '/'; - my $hyperlink = $base-url ~ encode-base64(gzip($return-url), :str); + my Str $return-url = $request.content.{'hyperlink'}; + my Str $url-scheme = $request.headers.{'X-Forwarded-Proto'} || 'http'; + my Str $url-host = $request.headers.{'Host'}; + my Str $base-url = $url-scheme ~ '://' ~ $url-host ~ '/'; + my Str $hyperlink = $base-url ~ encode-base64(gzip($return-url), :str); $response.html($templates.process: 'index', :$hyperlink); }); # Try a wildcard to catch 'all' path $router.get('/**', -> $request, $response { - my $return-url = $request.path.substr(1); # Omits the leading slash - my $redirect-url = gunzip(decode-base64($return-url, :bin)); + my Str $return-url = $request.path.substr(1); # Omits the leading slash + my Str $redirect-url = gunzip(decode-base64($return-url, :bin)); $response.redirect($redirect-url); });