diff options
author | Valery Piashchynski <[email protected]> | 2022-01-15 12:08:20 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2022-01-15 12:08:20 +0300 |
commit | 5254c8eb27311e2a8a53a4c90c3829cf1238c563 (patch) | |
tree | b51c9a4c1dd4c25adc511498ce0380a7078c5572 /tests/http | |
parent | 13609dd03dd0d2fa85b9fb850be787bf4e2ea67f (diff) |
Repository content update
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/http')
-rw-r--r-- | tests/http/client.php | 51 | ||||
-rw-r--r-- | tests/http/cookie.php | 334 | ||||
-rw-r--r-- | tests/http/data.php | 17 | ||||
-rw-r--r-- | tests/http/echo.php | 10 | ||||
-rw-r--r-- | tests/http/echoDelay.php | 11 | ||||
-rw-r--r-- | tests/http/echoerr.php | 12 | ||||
-rw-r--r-- | tests/http/env.php | 10 | ||||
-rw-r--r-- | tests/http/error.php | 9 | ||||
-rw-r--r-- | tests/http/error2.php | 9 | ||||
-rw-r--r-- | tests/http/header.php | 11 | ||||
-rw-r--r-- | tests/http/headers.php | 11 | ||||
-rw-r--r-- | tests/http/ip.php | 11 | ||||
-rw-r--r-- | tests/http/memleak.php | 11 | ||||
-rw-r--r-- | tests/http/payload.php | 18 | ||||
-rw-r--r-- | tests/http/pid.php | 11 | ||||
-rw-r--r-- | tests/http/push.php | 10 | ||||
-rw-r--r-- | tests/http/request-uri.php | 10 | ||||
-rw-r--r-- | tests/http/server.php | 11 | ||||
-rw-r--r-- | tests/http/slow-client.php | 52 | ||||
-rw-r--r-- | tests/http/stuck.php | 11 | ||||
-rw-r--r-- | tests/http/upload.php | 35 | ||||
-rw-r--r-- | tests/http/user-agent.php | 10 |
22 files changed, 0 insertions, 675 deletions
diff --git a/tests/http/client.php b/tests/http/client.php deleted file mode 100644 index 90b5c2b5..00000000 --- a/tests/http/client.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -use Spiral\Goridge; -use Spiral\RoadRunner; - -ini_set('display_errors', 'stderr'); -require dirname(__DIR__) . "/vendor/autoload.php"; - -if (count($argv) < 3) { - die("need 2 arguments"); -} - -list($test, $goridge) = [$argv[1], $argv[2]]; - -switch ($goridge) { - case "pipes": - $relay = new Goridge\StreamRelay(STDIN, STDOUT); - break; - - case "tcp": - $relay = new Goridge\SocketRelay("127.0.0.1", 9007); - break; - - case "unix": - $relay = new Goridge\SocketRelay( - "sock.unix", - null, - Goridge\SocketRelay::SOCK_UNIX - ); - break; - - default: - die("invalid protocol selection"); -} - -$psr7 = new RoadRunner\Http\PSR7Worker( - new RoadRunner\Worker($relay), - new \Nyholm\Psr7\Factory\Psr17Factory(), - new \Nyholm\Psr7\Factory\Psr17Factory(), - new \Nyholm\Psr7\Factory\Psr17Factory() -); - -require_once sprintf("%s/%s.php", __DIR__, $test); - -while ($req = $psr7->waitRequest()) { - try { - $psr7->respond(handleRequest($req, new \Nyholm\Psr7\Response())); - } catch (\Throwable $e) { - $psr7->getWorker()->error((string)$e); - } -} diff --git a/tests/http/cookie.php b/tests/http/cookie.php deleted file mode 100644 index 97673ef5..00000000 --- a/tests/http/cookie.php +++ /dev/null @@ -1,334 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write(strtoupper($req->getCookieParams()['input'])); - - return $resp->withAddedHeader( - "Set-Cookie", - (new Cookie('output', 'cookie-output'))->createHeader() - ); -} - -final class Cookie -{ - /** - * The name of the cookie. - * - * @var string - */ - private $name = ''; - /** - * The value of the cookie. This value is stored on the clients computer; do not store sensitive - * information. - * - * @var string|null - */ - private $value = null; - /** - * Cookie lifetime. This value specified in seconds and declares period of time in which cookie - * will expire relatively to current time() value. - * - * @var int|null - */ - private $lifetime = null; - /** - * The path on the server in which the cookie will be available on. - * - * If set to '/', the cookie will be available within the entire domain. If set to '/foo/', - * the cookie will only be available within the /foo/ directory and all sub-directories such as - * /foo/bar/ of domain. The default value is the current directory that the cookie is being set - * in. - * - * @var string|null - */ - private $path = null; - /** - * The domain that the cookie is available. To make the cookie available on all subdomains of - * example.com then you'd set it to '.example.com'. The . is not required but makes it - * compatible with more browsers. Setting it to www.example.com will make the cookie only - * available in the www subdomain. Refer to tail matching in the spec for details. - * - * @var string|null - */ - private $domain = null; - /** - * Indicates that the cookie should only be transmitted over a secure HTTPS connection from the - * client. When set to true, the cookie will only be set if a secure connection exists. - * On the server-side, it's on the programmer to send this kind of cookie only on secure - * connection - * (e.g. with respect to $_SERVER["HTTPS"]). - * - * @var bool|null - */ - private $secure = null; - /** - * When true the cookie will be made accessible only through the HTTP protocol. This means that - * the cookie won't be accessible by scripting languages, such as JavaScript. This setting can - * effectively help to reduce identity theft through XSS attacks (although it is not supported - * by all browsers). - * - * @var bool - */ - private $httpOnly = true; - - /** - * New Cookie instance, cookies used to schedule cookie set while dispatching Response. - * - * @link http://php.net/manual/en/function.setcookie.php - * - * @param string $name The name of the cookie. - * @param string $value The value of the cookie. This value is stored on the clients - * computer; do not store sensitive information. - * @param int $lifetime Cookie lifetime. This value specified in seconds and declares period - * of time in which cookie will expire relatively to current time() - * value. - * @param string $path The path on the server in which the cookie will be available on. - * If set to '/', the cookie will be available within the entire - * domain. - * If set to '/foo/', the cookie will only be available within the - * /foo/ - * directory and all sub-directories such as /foo/bar/ of domain. The - * default value is the current directory that the cookie is being set - * in. - * @param string $domain The domain that the cookie is available. To make the cookie - * available - * on all subdomains of example.com then you'd set it to - * '.example.com'. - * The . is not required but makes it compatible with more browsers. - * Setting it to www.example.com will make the cookie only available in - * the www subdomain. Refer to tail matching in the spec for details. - * @param bool $secure Indicates that the cookie should only be transmitted over a secure - * HTTPS connection from the client. When set to true, the cookie will - * only be set if a secure connection exists. On the server-side, it's - * on the programmer to send this kind of cookie only on secure - * connection (e.g. with respect to $_SERVER["HTTPS"]). - * @param bool $httpOnly When true the cookie will be made accessible only through the HTTP - * protocol. This means that the cookie won't be accessible by - * scripting - * languages, such as JavaScript. This setting can effectively help to - * reduce identity theft through XSS attacks (although it is not - * supported by all browsers). - */ - public function __construct( - string $name, - string $value = null, - int $lifetime = null, - string $path = null, - string $domain = null, - bool $secure = false, - bool $httpOnly = true - ) { - $this->name = $name; - $this->value = $value; - $this->lifetime = $lifetime; - $this->path = $path; - $this->domain = $domain; - $this->secure = $secure; - $this->httpOnly = $httpOnly; - } - - /** - * The name of the cookie. - * - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * The value of the cookie. This value is stored on the clients computer; do not store sensitive - * information. - * - * @return string|null - */ - public function getValue() - { - return $this->value; - } - - /** - * The time the cookie expires. This is a Unix timestamp so is in number of seconds since the - * epoch. In other words, you'll most likely set this with the time function plus the number of - * seconds before you want it to expire. Or you might use mktime. - * - * Will return null if lifetime is not specified. - * - * @return int|null - */ - public function getExpires() - { - if ($this->lifetime === null) { - return null; - } - - return time() + $this->lifetime; - } - - /** - * The path on the server in which the cookie will be available on. - * - * If set to '/', the cookie will be available within the entire domain. If set to '/foo/', - * the cookie will only be available within the /foo/ directory and all sub-directories such as - * /foo/bar/ of domain. The default value is the current directory that the cookie is being set - * in. - * - * @return string|null - */ - public function getPath() - { - return $this->path; - } - - /** - * The domain that the cookie is available. To make the cookie available on all subdomains of - * example.com then you'd set it to '.example.com'. The . is not required but makes it - * compatible with more browsers. Setting it to www.example.com will make the cookie only - * available in the www subdomain. Refer to tail matching in the spec for details. - * - * @return string|null - */ - public function getDomain() - { - return $this->domain; - } - - /** - * Indicates that the cookie should only be transmitted over a secure HTTPS connection from the - * client. When set to true, the cookie will only be set if a secure connection exists. - * On the server-side, it's on the programmer to send this kind of cookie only on secure - * connection - * (e.g. with respect to $_SERVER["HTTPS"]). - * - * @return bool - */ - public function isSecure(): bool - { - return $this->secure; - } - - /** - * When true the cookie will be made accessible only through the HTTP protocol. This means that - * the cookie won't be accessible by scripting languages, such as JavaScript. This setting can - * effectively help to reduce identity theft through XSS attacks (although it is not supported - * by all browsers). - * - * @return bool - */ - public function isHttpOnly(): bool - { - return $this->httpOnly; - } - - /** - * Get new cookie with altered value. Original cookie object should not be changed. - * - * @param string $value - * - * @return Cookie - */ - public function withValue(string $value): self - { - $cookie = clone $this; - $cookie->value = $value; - - return $cookie; - } - - /** - * Convert cookie instance to string. - * - * @link http://www.w3.org/Protocols/rfc2109/rfc2109 - * @return string - */ - public function createHeader(): string - { - $header = [ - rawurlencode($this->name) . '=' . rawurlencode($this->value) - ]; - if ($this->lifetime !== null) { - $header[] = 'Expires=' . gmdate(\DateTime::COOKIE, $this->getExpires()); - $header[] = 'Max-Age=' . $this->lifetime; - } - if (!empty($this->path)) { - $header[] = 'Path=' . $this->path; - } - if (!empty($this->domain)) { - $header[] = 'Domain=' . $this->domain; - } - if ($this->secure) { - $header[] = 'Secure'; - } - if ($this->httpOnly) { - $header[] = 'HttpOnly'; - } - - return join('; ', $header); - } - - /** - * New Cookie instance, cookies used to schedule cookie set while dispatching Response. - * Static constructor. - * - * @link http://php.net/manual/en/function.setcookie.php - * - * @param string $name The name of the cookie. - * @param string $value The value of the cookie. This value is stored on the clients - * computer; do not store sensitive information. - * @param int $lifetime Cookie lifetime. This value specified in seconds and declares period - * of time in which cookie will expire relatively to current time() - * value. - * @param string $path The path on the server in which the cookie will be available on. - * If set to '/', the cookie will be available within the entire - * domain. - * If set to '/foo/', the cookie will only be available within the - * /foo/ - * directory and all sub-directories such as /foo/bar/ of domain. The - * default value is the current directory that the cookie is being set - * in. - * @param string $domain The domain that the cookie is available. To make the cookie - * available - * on all subdomains of example.com then you'd set it to - * '.example.com'. - * The . is not required but makes it compatible with more browsers. - * Setting it to www.example.com will make the cookie only available in - * the www subdomain. Refer to tail matching in the spec for details. - * @param bool $secure Indicates that the cookie should only be transmitted over a secure - * HTTPS connection from the client. When set to true, the cookie will - * only be set if a secure connection exists. On the server-side, it's - * on the programmer to send this kind of cookie only on secure - * connection (e.g. with respect to $_SERVER["HTTPS"]). - * @param bool $httpOnly When true the cookie will be made accessible only through the HTTP - * protocol. This means that the cookie won't be accessible by - * scripting - * languages, such as JavaScript. This setting can effectively help to - * reduce identity theft through XSS attacks (although it is not - * supported by all browsers). - * - * @return Cookie - */ - public static function create( - string $name, - string $value = null, - int $lifetime = null, - string $path = null, - string $domain = null, - bool $secure = false, - bool $httpOnly = true - ): self { - return new self($name, $value, $lifetime, $path, $domain, $secure, $httpOnly); - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->createHeader(); - } -} diff --git a/tests/http/data.php b/tests/http/data.php deleted file mode 100644 index 6570936a..00000000 --- a/tests/http/data.php +++ /dev/null @@ -1,17 +0,0 @@ -<?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; -} diff --git a/tests/http/echo.php b/tests/http/echo.php deleted file mode 100644 index 08e29a26..00000000 --- a/tests/http/echo.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -use \Psr\Http\Message\ServerRequestInterface; -use \Psr\Http\Message\ResponseInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write(strtoupper($req->getQueryParams()['hello'])); - return $resp->withStatus(201); -} diff --git a/tests/http/echoDelay.php b/tests/http/echoDelay.php deleted file mode 100644 index 78e85477..00000000 --- a/tests/http/echoDelay.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -use \Psr\Http\Message\ServerRequestInterface; -use \Psr\Http\Message\ResponseInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - sleep(1); - $resp->getBody()->write(strtoupper($req->getQueryParams()['hello'])); - return $resp->withStatus(201); -} diff --git a/tests/http/echoerr.php b/tests/http/echoerr.php deleted file mode 100644 index 7e1d05e7..00000000 --- a/tests/http/echoerr.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -use \Psr\Http\Message\ServerRequestInterface; -use \Psr\Http\Message\ResponseInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - error_log(strtoupper($req->getQueryParams()['hello'])); - - $resp->getBody()->write(strtoupper($req->getQueryParams()['hello'])); - return $resp->withStatus(201); -} diff --git a/tests/http/env.php b/tests/http/env.php deleted file mode 100644 index 3755bdea..00000000 --- a/tests/http/env.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write($_SERVER['ENV_KEY']); - return $resp; -} diff --git a/tests/http/error.php b/tests/http/error.php deleted file mode 100644 index 527e4068..00000000 --- a/tests/http/error.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - throw new Error("error"); -} diff --git a/tests/http/error2.php b/tests/http/error2.php deleted file mode 100644 index 12a672ac..00000000 --- a/tests/http/error2.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - exit(); -} diff --git a/tests/http/header.php b/tests/http/header.php deleted file mode 100644 index 393d9623..00000000 --- a/tests/http/header.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write(strtoupper($req->getHeaderLine('input'))); - - return $resp->withAddedHeader("Header", $req->getQueryParams()['hello']); -} diff --git a/tests/http/headers.php b/tests/http/headers.php deleted file mode 100644 index b6f3967a..00000000 --- a/tests/http/headers.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write(json_encode($req->getHeaders())); - - return $resp; -} diff --git a/tests/http/ip.php b/tests/http/ip.php deleted file mode 100644 index 49eb9285..00000000 --- a/tests/http/ip.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write($req->getServerParams()['REMOTE_ADDR']); - - return $resp; -} diff --git a/tests/http/memleak.php b/tests/http/memleak.php deleted file mode 100644 index 197a7fb1..00000000 --- a/tests/http/memleak.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $mem = ''; - $mem .= str_repeat(" ", 1024*1024); - return $resp; -} diff --git a/tests/http/payload.php b/tests/http/payload.php deleted file mode 100644 index b7a0311f..00000000 --- a/tests/http/payload.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -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))); - - return $resp; -} diff --git a/tests/http/pid.php b/tests/http/pid.php deleted file mode 100644 index f22d8e23..00000000 --- a/tests/http/pid.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write((string)getmypid()); - - return $resp; -} diff --git a/tests/http/push.php b/tests/http/push.php deleted file mode 100644 index d88fc076..00000000 --- a/tests/http/push.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -use \Psr\Http\Message\ServerRequestInterface; -use \Psr\Http\Message\ResponseInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write(strtoupper($req->getQueryParams()['hello'])); - return $resp->withAddedHeader("Http2-Push", __FILE__)->withStatus(201); -} diff --git a/tests/http/request-uri.php b/tests/http/request-uri.php deleted file mode 100644 index d4c87551..00000000 --- a/tests/http/request-uri.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write($_SERVER['REQUEST_URI']); - return $resp; -} diff --git a/tests/http/server.php b/tests/http/server.php deleted file mode 100644 index 393d9623..00000000 --- a/tests/http/server.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write(strtoupper($req->getHeaderLine('input'))); - - return $resp->withAddedHeader("Header", $req->getQueryParams()['hello']); -} diff --git a/tests/http/slow-client.php b/tests/http/slow-client.php deleted file mode 100644 index 1eaa7bc8..00000000 --- a/tests/http/slow-client.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -use Spiral\Goridge; -use Spiral\RoadRunner; - -ini_set('display_errors', 'stderr'); -require dirname(__DIR__) . "/vendor/autoload.php"; - -if (count($argv) < 3) { - die("need 2 arguments"); -} - -[$test, $goridge, $bootDelay] = [$argv[1], $argv[2], $argv[3]]; -usleep($bootDelay * 1000); - -switch ($goridge) { - case "pipes": - $relay = new Goridge\StreamRelay(STDIN, STDOUT); - break; - - case "tcp": - $relay = new Goridge\SocketRelay("127.0.0.1", 9007); - break; - - case "unix": - $relay = new Goridge\SocketRelay( - "sock.unix", - null, - Goridge\SocketRelay::SOCK_UNIX - ); - break; - - default: - die("invalid protocol selection"); -} - -$psr7 = new RoadRunner\Http\PSR7Worker( - new RoadRunner\Worker($relay), - new \Nyholm\Psr7\Factory\Psr17Factory(), - new \Nyholm\Psr7\Factory\Psr17Factory(), - new \Nyholm\Psr7\Factory\Psr17Factory() -); - -require_once sprintf("%s/%s.php", __DIR__, $test); - -while ($req = $psr7->waitRequest()) { - try { - $psr7->respond(handleRequest($req, new \Nyholm\Psr7\Response())); - } catch (\Throwable $e) { - $psr7->getWorker()->error((string) $e); - } -} diff --git a/tests/http/stuck.php b/tests/http/stuck.php deleted file mode 100644 index 2dea0572..00000000 --- a/tests/http/stuck.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -use \Psr\Http\Message\ServerRequestInterface; -use \Psr\Http\Message\ResponseInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - sleep(10); - $resp->getBody()->write(strtoupper($req->getQueryParams()['hello'])); - return $resp->withStatus(201); -} diff --git a/tests/http/upload.php b/tests/http/upload.php deleted file mode 100644 index 57526246..00000000 --- a/tests/http/upload.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $files = $req->getUploadedFiles(); - array_walk_recursive($files, function (&$v) { - /** - * @var \Psr\Http\Message\UploadedFileInterface $v - */ - - if ($v->getError()) { - $v = [ - 'name' => $v->getClientFilename(), - 'size' => $v->getSize(), - 'mime' => $v->getClientMediaType(), - 'error' => $v->getError(), - ]; - } else { - $v = [ - 'name' => $v->getClientFilename(), - 'size' => $v->getSize(), - 'mime' => $v->getClientMediaType(), - 'error' => $v->getError(), - 'sha512' => hash('sha512', $v->getStream()->__toString()), - ]; - } - }); - - $resp->getBody()->write(json_encode($files, JSON_UNESCAPED_SLASHES)); - - return $resp; -} diff --git a/tests/http/user-agent.php b/tests/http/user-agent.php deleted file mode 100644 index 03d7a2c8..00000000 --- a/tests/http/user-agent.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $resp->getBody()->write($_SERVER['HTTP_USER_AGENT']); - return $resp; -} |