#!/usr/bin/perl
my
$matrix
= Net::Async::Matrix->new(
ua
=>
my
$ua
= Test::Async::HTTP->new,
server
=>
"localserver.test"
,
make_delay
=>
sub
{ Future->new },
);
IO::Async::Loop->new->add(
$matrix
);
matrix_login(
$matrix
,
$ua
);
{
my
$f
=
$matrix
->upload(
content
=>
"Here is the content"
,
content_type
=>
"text/plain"
,
);
ok(
my
$p
= next_pending_not_sync(
$ua
),
'->upload sends an HTTP request'
);
is(
$p
->request->method,
"POST"
,
'$req->method'
);
my
$uri
=
$p
->request->uri;
is(
$uri
->authority,
"localserver.test"
,
'$req->uri->authority'
);
is(
$uri
->path,
"/_matrix/media/v1/upload"
,
'$req->uri->path'
);
is(
$p
->request->content_type,
"text/plain"
,
'$req->content_type'
);
is(
$p
->request->content,
"Here is the content"
,
'$req->content'
);
ok(
$f
->is_ready,
'$f now ready after /upload response'
);
}
{
'$matrix->convert_mxc_url'
);
}
done_testing;