Merge pull request #4147 from nextcloud/fix_3890
Don't try to parse empty body if there is no body
This commit is contained in:
commit
0d69b52fde
|
@ -401,6 +401,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
||||||
protected function getContent() {
|
protected function getContent() {
|
||||||
// If the content can't be parsed into an array then return a stream resource.
|
// If the content can't be parsed into an array then return a stream resource.
|
||||||
if ($this->method === 'PUT'
|
if ($this->method === 'PUT'
|
||||||
|
&& $this->getHeader('Content-Length') !== 0
|
||||||
|
&& $this->getHeader('Content-Length') !== null
|
||||||
&& strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false
|
&& strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false
|
||||||
&& strpos($this->getHeader('Content-Type'), 'application/json') === false
|
&& strpos($this->getHeader('Content-Type'), 'application/json') === false
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -305,7 +305,10 @@ class RequestTest extends \Test\TestCase {
|
||||||
$vars = array(
|
$vars = array(
|
||||||
'put' => $data,
|
'put' => $data,
|
||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
'server' => array('CONTENT_TYPE' => 'image/png'),
|
'server' => [
|
||||||
|
'CONTENT_TYPE' => 'image/png',
|
||||||
|
'CONTENT_LENGTH' => strlen($data)
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
$request = new Request(
|
$request = new Request(
|
||||||
|
|
Loading…
Reference in New Issue