Skip to content

Commit

Permalink
Split numericVal to intVal and floatVal
Browse files Browse the repository at this point in the history
  • Loading branch information
PineappleIOnic committed Aug 6, 2024
1 parent 4ef3945 commit dc1e59b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions app/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,11 +763,17 @@ function (string $runtimeId, ?string $payload, string $path, string $method, mix
}

// Extra parsers and validators to support both JSON and multipart
$intParams = ['timeout', 'memory'];
foreach ($intParams as $intParam) {
if (!empty($$intParam) && !is_numeric($$intParam)) {
$$intParam = \intval($$intParam);
}
}

$numericParams = ['timeout', 'cpus', 'memory'];
foreach ($numericParams as $numericParam) {
if (!empty($$numericParam) && !is_numeric($$numericParam)) {
$$numericParam = \floatval($$numericParam);
$floatParams = ['cpus'];
foreach ($floatParams as $floatPram) {
if (!empty($$floatPram) && !is_numeric($$floatPram)) {
$$floatPram = \floatval($$floatPram);
}
}

Expand Down

0 comments on commit dc1e59b

Please sign in to comment.