Merge pull request #151 from dstelljes/body-cache

PUT only allows php://input to be read once
pull/155/head
Mike Cao 10 years ago
commit dc15094141

@ -196,15 +196,20 @@ class Request {
* *
* @return string Raw HTTP request body * @return string Raw HTTP request body
*/ */
public static function getBody() public static function getBody() {
{ static $body;
if (!is_null($body)) {
return $body;
}
$method = self::getMethod(); $method = self::getMethod();
if ($method == 'POST' || $method == 'PUT') { if ($method == 'POST' || $method == 'PUT') {
return file_get_contents('php://input'); $body = file_get_contents('php://input');
} }
return ''; return $body;
} }
/** /**

Loading…
Cancel
Save