diff options
Diffstat (limited to 'php-src')
-rw-r--r-- | php-src/tests/http/data.php | 18 | ||||
-rw-r--r-- | php-src/tests/http/payload.php | 13 |
2 files changed, 31 insertions, 0 deletions
diff --git a/php-src/tests/http/data.php b/php-src/tests/http/data.php new file mode 100644 index 00000000..c5e0bab0 --- /dev/null +++ b/php-src/tests/http/data.php @@ -0,0 +1,18 @@ +<?php + +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; + +function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface +{ + + $data = $req->getParsedBody(); + + ksort($data); + ksort($data['arr']); + ksort($data['arr']['x']['y']); + + $resp->getBody()->write(json_encode($data)); + + return $resp; +}
\ No newline at end of file diff --git a/php-src/tests/http/payload.php b/php-src/tests/http/payload.php new file mode 100644 index 00000000..a16984c5 --- /dev/null +++ b/php-src/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 |