Welcome Guest, Not a member yet? Register   Sign In
Validate JSON?
#2

When you call $this->validate($rules), the method will automatically try to determine the content type and retrieve data for validation.

When you call $this->validation->run($_POST), you yourself define the data to validate. But if I am not mistaken, then with the content-type application/json, the $_POST array will be empty.

Call $this->validation->run($this->request->getJSON(true));
Reply


Messages In This Thread
Validate JSON? - by wojtek_us - 09-22-2021, 09:38 AM
RE: Validate JSON? - by iRedds - 09-23-2021, 04:13 AM
RE: Validate JSON? - by wojtek_us - 09-23-2021, 07:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB