diff --git a/flight/net/Request.php b/flight/net/Request.php index 628c4f3..c2142e1 100644 --- a/flight/net/Request.php +++ b/flight/net/Request.php @@ -120,6 +120,11 @@ class Request { */ public $proxy_ip; + /** + * @var mixed Data from the request body + */ + protected static $body; + /** * Constructor. * @@ -198,13 +203,18 @@ class Request { */ public static function getBody() { + if (!is_null(self::$body)) { + return self::$body; + } + + $body = ''; $method = self::getMethod(); if ($method == 'POST' || $method == 'PUT') { - return file_get_contents('php://input'); + $body = file_get_contents('php://input'); } - return ''; + return self::$body = $body; } /**