How to validate an API REST? |
(04-17-2020, 12:59 PM)jreklund Wrote: There are a hidden function named setGlobal (hidden as it's not in the documentation yet). That allow you to set get, post etc. Hello, interesting function. I ran some tests with it separately and I think I found some bugs. Try using: PHP Code: $this->request->setGlobal('post', ['id' => $id]); When using getVar, the declaration is not recognized. However, if you use getPost or getGet, the parameter will be recognized. PHP Code: $this->request->setGlobal('post', ['id' => $id]); And the $this->validate function within it has the withRequest that the request is getVar() PHP Code: public function withRequest(RequestInterface $request): ValidationInterface Solved using: PHP Code: public function show($id = null) Since withRequest identifies only the getVar that receives $ _REQUEST, I created the variable of this type. However, an issue addressed in the post above is still open. |
Messages In This Thread |
How to validate an API REST? - by MatheusCastro - 04-17-2020, 10:36 AM
RE: How to validate an API REST? - by jreklund - 04-17-2020, 12:59 PM
RE: How to validate an API REST? - by MatheusCastro - 04-17-2020, 02:04 PM
|