From ebe9bea709dd74e3cab3bbb8e9b1ea141bdf90bf Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Wed, 23 Sep 2015 14:16:41 +0100 Subject: Unit test for preventing warning decoding content --- tests/lib/appframework/http/RequestTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php index deb28909869..5140e37e515 100644 --- a/tests/lib/appframework/http/RequestTest.php +++ b/tests/lib/appframework/http/RequestTest.php @@ -202,6 +202,27 @@ class RequestTest extends \Test\TestCase { $this->assertEquals('Joey', $request['nickname']); } + public function testNotJsonPost() { + global $data; + $data = 'this is not valid json'; + $vars = array( + 'method' => 'POST', + 'server' => array('CONTENT_TYPE' => 'application/json; utf-8') + ); + + $request = new Request( + $vars, + $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), + $this->config, + $this->stream + ); + + $this->assertEquals('POST', $request->method); + $result = $request->post; + // ensure there's no error attempting to decode the content + } + public function testPatch() { global $data; $data = http_build_query(array('name' => 'John Q. Public', 'nickname' => 'Joey'), '', '&'); -- cgit v1.2.3