summaryrefslogtreecommitdiff
path: root/tests/http/payload.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/http/payload.php')
-rw-r--r--tests/http/payload.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/http/payload.php b/tests/http/payload.php
new file mode 100644
index 00000000..a16984c5
--- /dev/null
+++ b/tests/http/payload.php
@@ -0,0 +1,13 @@
+<?php
+
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+
+function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface
+{
+ // we expect json body
+ $p = json_decode($req->getBody(), true);
+ $resp->getBody()->write(json_encode(array_flip($p)));
+
+ return $resp;
+} \ No newline at end of file