{"action":"created","issue":{"url":"https://api.github.com/repos/slimphp/Slim/issues/1561","labels_url":"https://api.github.com/repos/slimphp/Slim/issues/1561/labels{/name}","comments_url":"https://api.github.com/repos/slimphp/Slim/issues/1561/comments","events_url":"https://api.github.com/repos/slimphp/Slim/issues/1561/events","html_url":"https://github.com/slimphp/Slim/issues/1561","id":114120627,"number":1561,"title":"Response Body is empty","user":{"login":"shashvattrip","id":2312691,"avatar_url":"https://avatars.githubusercontent.com/u/2312691?v=3","gravatar_id":"","url":"https://api.github.com/users/shashvattrip","html_url":"https://github.com/shashvattrip","followers_url":"https://api.github.com/users/shashvattrip/followers","following_url":"https://api.github.com/users/shashvattrip/following{/other_user}","gists_url":"https://api.github.com/users/shashvattrip/gists{/gist_id}","starred_url":"https://api.github.com/users/shashvattrip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shashvattrip/subscriptions","organizations_url":"https://api.github.com/users/shashvattrip/orgs","repos_url":"https://api.github.com/users/shashvattrip/repos","events_url":"https://api.github.com/users/shashvattrip/events{/privacy}","received_events_url":"https://api.github.com/users/shashvattrip/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-10-29T18:47:13Z","updated_at":"2015-11-04T12:26:09Z","closed_at":null,"body":"I have been stuck at this for sometime now can cannot figure out what the problem is. The same code was working few minutes ago and it suddenly stopped working, on its own, without me making any changes to it whatsoever.\r\nAs you can see from the code, there are two roles. Now, when I try to use the /login POST API, I am able to login with RoleA. However with RoleB (the only other role in the DB) I get an empty response from the server. When I say empty I mean the body is empty with response status 200 and content length = 0.\r\n\r\nI know its not the php code because the same code was working a few minutes ago and it still is on my AWS instance. I have checked apache error logs and couldn't find anything. What could be the problem and how do I go about finding the solution (or even the zeroing in on the problem because I am not able to figure out what the problem is)?\r\n\r\n```\r\n$app->post('/login', function () use ($app) {\r\n  try {\r\n    $user = Sentinel::authenticate($userCredentials);\r\n    if ($user == false) {\r\n      $appResponseMessage = \"Unauthorized\";\r\n      $app->response->setStatus(401);\r\n      $appResponseJson = json_encode(array('message' => $appResponseMessage));\r\n      $app->response->body($appResponseJson);\r\n    } \r\n    else {\r\n      $loggedIn = Sentinel::login($user);\r\n      $role=$user[\"roles\"][0][\"slug\"];      \r\n      $userId=$user[\"id\"];\r\n      if ($role == \"roleA\") {\r\n        //Do something here[1]\r\n        $appResponseMessage['message'] = \"loggedIn\";\r\n        $appResponseMessage['role'] = $role;\r\n      } \r\n      else {\r\n        // Do something here [2]\r\n        $appResponseMessage['message'] = \"loggedIn\";\r\n        $appResponseMessage['role'] = $role;\r\n      }\r\n      $appResponseJson = json_encode($appResponseMessage);\r\n      $app->response->body($appResponseJson);\r\n    }\r\n  }\r\n  catch(Exception $e) {\r\n    $appResponseJson = json_encode(array('message' => $e->getMessage()));\r\n    $app->response->body($appResponseJson);\r\n  }\r\n});\r\n```\r\n\r\nThanks!\r\n\r\nEDIT: \r\nI tried doing this around [2]\r\n```\r\nprint_r($appResponseMessage); //or anything just to check if this code was being executed and found out that it was.\r\n```\r\nDoes this indicates that there might be an issue with $app->response->body() method?\r\nAgain I am not sure."},"comment":{"url":"https://api.github.com/repos/slimphp/Slim/issues/comments/153704429","html_url":"https://github.com/slimphp/Slim/issues/1561#issuecomment-153704429","issue_url":"https://api.github.com/repos/slimphp/Slim/issues/1561","id":153704429,"user":{"login":"shashvattrip","id":2312691,"avatar_url":"https://avatars.githubusercontent.com/u/2312691?v=3","gravatar_id":"","url":"https://api.github.com/users/shashvattrip","html_url":"https://github.com/shashvattrip","followers_url":"https://api.github.com/users/shashvattrip/followers","following_url":"https://api.github.com/users/shashvattrip/following{/other_user}","gists_url":"https://api.github.com/users/shashvattrip/gists{/gist_id}","starred_url":"https://api.github.com/users/shashvattrip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shashvattrip/subscriptions","organizations_url":"https://api.github.com/users/shashvattrip/orgs","repos_url":"https://api.github.com/users/shashvattrip/repos","events_url":"https://api.github.com/users/shashvattrip/events{/privacy}","received_events_url":"https://api.github.com/users/shashvattrip/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T12:26:09Z","updated_at":"2015-11-04T12:26:09Z","body":"Yup, lesson learnt on special characters."}}