api-test.t: set a default method

This commit is contained in:
Graham Christensen 2022-01-10 10:38:48 -05:00
parent 832fa8c73d
commit 6b2f0a9fe1

View file

@ -42,7 +42,7 @@ sub request_json {
$req->uri("http://localhost$opts->{uri}");
$req->header(Accept => "application/json");
$req->header(Content_Type => "application/json");
$req->header(Origin => "http://localhost/") if $opts->{method} eq "POST";
$req->header(Origin => "http://localhost/") if ($opts->{method} // "") eq "POST";
$req->header(Cookie => $cookie);
$req->content(encode_json($opts->{data})) if defined $opts->{data};