Skip to content

Commit

Permalink
API validator warns about POST requests handled by get
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Sep 14, 2024
1 parent f9afc92 commit ac8f976
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/api/api_specvalidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class SpecValidator_API {
const F_DEPRECATED = 32;

static function request($uf, Qrequest $qreq) {
if ($qreq->is_post() && !($uf->post ?? false)) {
self::error($qreq, "POST request handled by get handler");
}

$parameters = $uf->parameters ?? [];
if (is_string($parameters)) {
$parameters = explode(" ", trim($parameters));
Expand Down Expand Up @@ -39,6 +43,7 @@ static function request($uf, Qrequest $qreq) {
$n = substr($p, $i);
$known[$n] = $t;
}

$param = [];
foreach (array_keys($_GET) as $n) {
if (($t = self::lookup_type($n, $known, $has_suffix)) === null) {
Expand Down

0 comments on commit ac8f976

Please sign in to comment.