summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Matrix/Client/Requester.pm66
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Matrix/Client/Requester.pm6 b/lib/Matrix/Client/Requester.pm6
index 0bb7e3a..9cabf9c 100644
--- a/lib/Matrix/Client/Requester.pm6
+++ b/lib/Matrix/Client/Requester.pm6
@@ -40,7 +40,8 @@ method base-url(Bool :$media? = False --> Str) {
}
multi method post(Str $path, Str $json, :$media = False) {
- my $req = HTTP::Request.new(POST => $.base-url(:$media) ~ $path ~ "?access_token=$!access-token",
+ my $url = $.base-url(:$media) ~ $path ~ "?access_token=$!access-token";
+ my $req = HTTP::Request.new(POST => $url,
Content-Type => 'application/json');
$req.add-content($json);
@@ -48,7 +49,8 @@ multi method post(Str $path, Str $json, :$media = False) {
}
multi method post(Str $path, :$media = False, *%params) {
- self.post($path, :$media, to-json(%params))
+ my $json = to-json(%params);
+ nextwith($path, $json, :$media)
}
method post-bin(Str $path, Buf $buf, :$content-type) {