Merge pull request #1097 from DeterminateSystems/api-test-warnings

Api test warnings: clean up
This commit is contained in:
Graham Christensen 2022-01-10 14:03:38 -05:00 committed by GitHub
commit 98c88a4dbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View file

@ -239,7 +239,7 @@ sub updateJobset {
error($c, "Cannot rename jobset to $jobsetName since that identifier is already taken.")
if $jobsetName ne $oldName && defined $c->stash->{project}->jobsets->find({ name => $jobsetName });
my $type = int($c->stash->{params}->{"type"}) // 0;
my $type = int($c->stash->{params}->{"type"} // 0);
my ($nixExprPath, $nixExprInput);
my $flake;
@ -270,7 +270,7 @@ sub updateJobset {
, enableemail => defined $c->stash->{params}->{enableemail} ? 1 : 0
, emailoverride => trim($c->stash->{params}->{emailoverride}) || ""
, hidden => defined $c->stash->{params}->{visible} ? 0 : 1
, keepnr => int(trim($c->stash->{params}->{keepnr}))
, keepnr => int(trim($c->stash->{params}->{keepnr} // "0"))
, checkinterval => $checkinterval
, triggertime => ($enabled && $checkinterval > 0) ? $jobset->triggertime // time() : undef
, schedulingshares => $shares

View file

@ -42,12 +42,11 @@ 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};
my $res = request($req);
print $res->as_string();
return $res;
}