Skip to content

Commit 29975a2

Browse files
author
Caio Iglesias
committed
http code 204 was causing an error 500
When trying to send back $this->response(null, 204) the code would crash when handling the empty data.
1 parent 8dca4b3 commit 29975a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

application/libraries/REST_Controller.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ public function response($data = array(), $http_code = null)
368368
$output = NULL;
369369
}
370370

371+
// If data is empty but http code provided, keep the output empty
372+
else if (empty($data) && is_numeric($http_code))
373+
{
374+
$output = NULL;
375+
}
376+
371377
// Otherwise (if no data but 200 provided) or some data, carry on camping!
372378
else
373379
{

0 commit comments

Comments
 (0)