Welcome Guest, Not a member yet? Register   Sign In
Development Environment for API
#1

Testing out some API thru Postman, but got the following error while trying to test HTTP 204 response under CI_ENVIRONMENT=development.

It is working fine when CI_ENVIRONMENT=production, and Postman shows a proper 204 response code.

Code:
GET http://localhost:8080/api/test?param1=1&param2=2
Error: Parse Error: Expected HTTP/
Request Headers
Accept: application/json
User-Agent: PostmanRuntime/7.26.10
Cache-Control: no-cache
Postman-Token: 93400af1-e209-49ed-801d-406ab5d76907
Host: localhost:8080
Accept-Encoding: gzip, deflate, br
Connection: keep-alive

Controller
PHP Code:
$data $this->model
    
->where('param1'$this->request->getGet('param1'))
    ->where('param2'$this->request->getGet('param2'))
    ->first();

if (
$data) {
    return $this->respond($data);
}

return 
$this->respondNoContent(); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB