JSON method should send a clean response.

pull/87/head
Mike Cao 11 years ago
parent 30195237e5
commit 777ac096ec

@ -278,7 +278,7 @@ class Engine {
// Flush any existing output // Flush any existing output
if (ob_get_length() > 0) { if (ob_get_length() > 0) {
$this->response()->write(ob_get_contents()); $this->response()->write(ob_get_clean());
} }
// Enable output buffering // Enable output buffering
@ -443,7 +443,7 @@ class Engine {
public function _json($data, $code = 200, $encode = true) { public function _json($data, $code = 200, $encode = true) {
$json = ($encode) ? json_encode($data) : $data; $json = ($encode) ? json_encode($data) : $data;
$this->response() $this->response(false)
->status($code) ->status($code)
->header('Content-Type', 'application/json') ->header('Content-Type', 'application/json')
->write($json) ->write($json)

Loading…
Cancel
Save