forked from lix-project/hydra
Fix API tests
POST requests require a referrer now. http://hydra.nixos.org/build/42775011
This commit is contained in:
parent
3b84d4711b
commit
cc866bff1e
|
@ -11,6 +11,7 @@ sub request_json {
|
||||||
$req->method($opts->{method} or "GET");
|
$req->method($opts->{method} or "GET");
|
||||||
$req->uri("http://localhost:3000$opts->{uri}");
|
$req->uri("http://localhost:3000$opts->{uri}");
|
||||||
$req->header(Accept => "application/json");
|
$req->header(Accept => "application/json");
|
||||||
|
$req->header(Referer => "http://localhost:3000/") if $opts->{method} eq "POST";
|
||||||
$req->content(encode_json($opts->{data})) if defined $opts->{data};
|
$req->content(encode_json($opts->{data})) if defined $opts->{data};
|
||||||
my $res = $ua->request($req);
|
my $res = $ua->request($req);
|
||||||
print $res->as_string();
|
print $res->as_string();
|
||||||
|
|
Loading…
Reference in a new issue