Created
November 30, 2022 17:07
-
-
Save JJ/e5e6c9789e6dd2c2221744339c0e0bc2 to your computer and use it in GitHub Desktop.
Revisions
-
JJ created this gist
Nov 30, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ sub server-login() { my Lock \l .= new; our $cro; l.protect: { my $c = Cro::HTTP::Client.new: base-uri => SERVER-URL, content-type => JSON, user-agent => 'honking/2022.2.1', timeout => %( connection => 240, headers => 480, ), cookie-jar => Cro::HTTP::Client::CookieJar.new, ; await $c.post: "{SERVER-URI}/{SESSION-PATH}", body => CREDENTIALS $cro = $c } $cro } sub server-post($data) { our $cro; my $r = await $cro.post: "{SERVER-URI}/{DATA-PATH}", body => $data; await $r.body }