Sending a response should not exit the program.

We need to allow events to fire after the stop method is called. This will allow users to clean up resources, perform logging, etc.
pull/57/merge
Mike Cao 11 years ago
parent 5ba910981f
commit b8026d9828

@ -164,13 +164,11 @@ class Response {
} }
/** /**
* Sends the response and exits the program. * Sends HTTP headers.
*
* @return object Self reference
*/ */
public function send() { public function sendHeaders() {
if (ob_get_length() > 0) {
ob_end_clean();
}
if (!headers_sent()) { if (!headers_sent()) {
// Send status code header // Send status code header
if (strpos(php_sapi_name(), 'cgi') !== false) { if (strpos(php_sapi_name(), 'cgi') !== false) {
@ -208,7 +206,24 @@ class Response {
} }
} }
exit($this->body); return $this;
}
/**
* Sends a HTTP response.
*
* @return object Self reference
*/
public function send() {
if (ob_get_length() > 0) {
ob_end_clean();
}
$this->sendHeaders();
echo $this->body;
return $this;
} }
} }

Loading…
Cancel
Save