From b9dfda3fd692421832b650744343b4fce6fe27d6 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Wed, 9 Dec 2015 01:06:00 -0800 Subject: [PATCH] Do not send a new response for json requests. --- VERSION | 2 +- flight/Engine.php | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index b66183a..591bdbc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.17 +1.2.18 diff --git a/flight/Engine.php b/flight/Engine.php index 9d1e941..0823f3e 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -295,11 +295,6 @@ class Engine { // Enable error handling $this->handleErrors($this->get('flight.handle_errors')); - // Disable caching for AJAX requests - if ($request->ajax) { - $response->cache(false); - } - // Allow post-filters to run $this->after('start', function() use ($self) { $self->stop(); @@ -350,7 +345,7 @@ class Engine { * @param string $message Response message */ public function _halt($code = 200, $message = '') { - $this->response(false) + $this->response() ->status($code) ->write($message) ->send(); @@ -457,7 +452,7 @@ class Engine { public function _json($data, $code = 200, $encode = true) { $json = ($encode) ? json_encode($data) : $data; - $this->response(false) + $this->response() ->status($code) ->header('Content-Type', 'application/json') ->write($json) @@ -477,7 +472,7 @@ class Engine { $callback = $this->request()->query[$param]; - $this->response(false) + $this->response() ->status($code) ->header('Content-Type', 'application/javascript') ->write($callback.'('.$json.');')