summaryrefslogtreecommitdiff
path: root/tests/http/payload.php
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-01-05 13:35:58 +0300
committerWolfy-J <[email protected]>2019-01-05 13:35:58 +0300
commit04f7ac73c477938b7390ec6ec101d0e4bcc8cd80 (patch)
tree361c8cd8a00824d0b2e5003c6a5978f630c20469 /tests/http/payload.php
parent46009112a783a1fdae95e0a061d4c8c41a1c8ff1 (diff)
second set of patches
Diffstat (limited to 'tests/http/payload.php')
-rw-r--r--tests/http/payload.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/http/payload.php b/tests/http/payload.php
index a16984c5..52c0f819 100644
--- a/tests/http/payload.php
+++ b/tests/http/payload.php
@@ -5,6 +5,11 @@ use Psr\Http\Message\ServerRequestInterface;
function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface
{
+ if ( $req->getHeaderLine("Content-Type") != 'application/json' ) {
+ $resp->getBody()->write("invalid content-type");
+ return $resp;
+ }
+
// we expect json body
$p = json_decode($req->getBody(), true);
$resp->getBody()->write(json_encode(array_flip($p)));