Find Bug in CI4 |
hi i m huge fan ci4
i was facing issue which pin in ass but solve it i figure out which CI4 can not validate Ajax request (JSON Raw Input) with Postman or Angular 9 i was customizing Math/Auth for RestFull API JWT Authentication i got error which can not validate Raw Input JSON heres part of code auth controoler Code: if ($this->request->isAJAX()) { i connot validate And Got Error I dont send login and password Code: if (!$this->validate($rules)) { i go to validation class CI4 then function withRequest() Code: public function withRequest(RequestInterface $request): ValidationInterface add this line to code and fix bug easily Code: public function withRequest(RequestInterface $request): ValidationInterface i hope next version ci4 add this line to code thanks to great team ci4
Enlightenment Is Freedom
i m not nob user i know ci3 and ci4 very well . i have a personal website written by ci3 www.paliz3d.com
i love ci
Enlightenment Is Freedom
Did you use your web browsers developer tools F-12 console to see what is happing?
Did you send the Ajax X-Requested-With header? What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(10-09-2020, 10:16 PM)InsiteFX Wrote: Did you use your web browsers developer tools F-12 console to see what is happing?I write sample restful api with angular9 and use chrome and i got error which i didnot post variables And i test with postman with header ajax and alao got error too The data sent but can not be validate After test every thing i find out data dose not pass to validation class. Add if condation in validawith() thrn i fix problem This code ads to validation with request function If ($resquest->isAjax()) { $this->data=$request->getJson(true) }
Enlightenment Is Freedom
Glad you got it fixed.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
If this is a bug in the code you can open a new issue in the github repo for it to be addressed in the next version.
|
Welcome Guest, Not a member yet? Register Sign In |