Do not send a new response for json requests.

pull/226/head v1.2.18
Mike Cao 9 years ago
parent cabbb25fcc
commit b9dfda3fd6

@ -1 +1 @@
1.2.17 1.2.18

@ -295,11 +295,6 @@ class Engine {
// Enable error handling // Enable error handling
$this->handleErrors($this->get('flight.handle_errors')); $this->handleErrors($this->get('flight.handle_errors'));
// Disable caching for AJAX requests
if ($request->ajax) {
$response->cache(false);
}
// Allow post-filters to run // Allow post-filters to run
$this->after('start', function() use ($self) { $this->after('start', function() use ($self) {
$self->stop(); $self->stop();
@ -350,7 +345,7 @@ class Engine {
* @param string $message Response message * @param string $message Response message
*/ */
public function _halt($code = 200, $message = '') { public function _halt($code = 200, $message = '') {
$this->response(false) $this->response()
->status($code) ->status($code)
->write($message) ->write($message)
->send(); ->send();
@ -457,7 +452,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(false) $this->response()
->status($code) ->status($code)
->header('Content-Type', 'application/json') ->header('Content-Type', 'application/json')
->write($json) ->write($json)
@ -477,7 +472,7 @@ class Engine {
$callback = $this->request()->query[$param]; $callback = $this->request()->query[$param];
$this->response(false) $this->response()
->status($code) ->status($code)
->header('Content-Type', 'application/javascript') ->header('Content-Type', 'application/javascript')
->write($callback.'('.$json.');') ->write($callback.'('.$json.');')

Loading…
Cancel
Save