[BIGUPDATE: api.core.Request] Now the api tries to parse JSON parameters (if cannot, they are considered as text) -> the parsed data is passed to controllers -> the checker uses the parsed data
This commit is contained in:
parent
3c97079d25
commit
a9fec0373e
|
@ -374,6 +374,13 @@
|
||||||
/* (2) Si le paramètre est renseigné (sauf FILE) */
|
/* (2) Si le paramètre est renseigné (sauf FILE) */
|
||||||
}elseif( $config['typ'] != 'FILE' ){
|
}elseif( $config['typ'] != 'FILE' ){
|
||||||
|
|
||||||
|
// Try to get json representation
|
||||||
|
$json_rep = json_decode('{"json": '.$this->raw_params[$name].'}', true);
|
||||||
|
|
||||||
|
// Use only if not failed
|
||||||
|
if( is_array($json_rep) && isset($json_rep['json']) )
|
||||||
|
$this->raw_params[$name] = $json_rep['json'];
|
||||||
|
|
||||||
// Si la verification est fausse, on retourne faux
|
// Si la verification est fausse, on retourne faux
|
||||||
if( !Checker::run($config['typ'], $this->raw_params[$name]) )
|
if( !Checker::run($config['typ'], $this->raw_params[$name]) )
|
||||||
return $this->error->set(Err::WrongParam, $rename, $config['typ']);
|
return $this->error->set(Err::WrongParam, $rename, $config['typ']);
|
||||||
|
|
Loading…
Reference in New Issue