Skip to content

Commit 03502e1

Browse files
authored
added method to retrieve plain request content (#16)
1 parent 35b0eb9 commit 03502e1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Nono/Request.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct()
2424
{
2525
$_SERVER;
2626
if (!in_array($this->method(), ['GET', 'POST'])) {
27-
parse_str(file_get_contents('php://input'), $GLOBALS['_QUERY']);
27+
parse_str($this->content(), $GLOBALS['_QUERY']);
2828
}
2929
}
3030

@@ -58,6 +58,16 @@ public function method()
5858
return $this->server('REQUEST_METHOD');
5959
}
6060

61+
/**
62+
* Return plain text request content.
63+
*
64+
* @return string
65+
*/
66+
public function content()
67+
{
68+
return file_get_contents('php://input');
69+
}
70+
6171
/**
6272
* Return whether the request URL is HTTPS URL or not.
6373
* Questionable reliability -> depends upon server config.

0 commit comments

Comments
 (0)