Skip to content

Commit

Permalink
Merge remote-tracking branch 'mikecao/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
cceconi committed Mar 20, 2015
2 parents ef4f2ad + 10750b5 commit c1b9ecc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.9
1.2.12
10 changes: 6 additions & 4 deletions flight/net/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static function getBody() {

$method = self::getMethod();

if ($method == 'POST' || $method == 'PUT') {
if ($method == 'POST' || $method == 'PUT' || $method == 'PATCH') {
$body = file_get_contents('php://input');
}

Expand All @@ -218,14 +218,16 @@ public static function getBody() {
* @return string
*/
public static function getMethod() {
$method = self::getVar('REQUEST_METHOD', 'GET');

if (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
return $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'];
$method = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'];
}
elseif (isset($_REQUEST['_method'])) {
return $_REQUEST['_method'];
$method = $_REQUEST['_method'];
}

return self::getVar('REQUEST_METHOD', 'GET');
return strtoupper($method);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion flight/net/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ public function cache($expires) {
$this->headers['Expires'] = gmdate('D, d M Y H:i:s', $expires) . ' GMT';
$this->headers['Cache-Control'] = 'max-age='.($expires - time());
}

return $this;
}

Expand Down Expand Up @@ -236,6 +235,11 @@ public function sendHeaders() {
}
}

// Send content length
if (($length = strlen($this->body)) > 0) {
header('Content-Length: '.$length);
}

return $this;
}

Expand Down

0 comments on commit c1b9ecc

Please sign in to comment.