summaryrefslogtreecommitdiff
path: root/tests/src/Http/Request.php
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-15 13:31:40 +0300
committerGitHub <[email protected]>2020-12-15 13:31:40 +0300
commitb44d272312389691920e42e5295395bef0d3b769 (patch)
tree1c826999423e59db5b7dab1184725e22468ecfbd /tests/src/Http/Request.php
parent673da74925dee5c62064d3304289ae81cb499217 (diff)
parent7b0a6720c21056ed4b922eb5b1b8a91a44dc3638 (diff)
Merge pull request #447 from spiral/feature/goridge3
Feature/goridge3
Diffstat (limited to 'tests/src/Http/Request.php')
-rw-r--r--tests/src/Http/Request.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/src/Http/Request.php b/tests/src/Http/Request.php
new file mode 100644
index 00000000..ef67e28d
--- /dev/null
+++ b/tests/src/Http/Request.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * Spiral Framework.
+ *
+ * @license MIT
+ * @author Anton Titov (Wolfy-J)
+ */
+
+declare(strict_types=1);
+
+namespace Spiral\RoadRunner\Http;
+
+final class Request
+{
+
+ public string $remoteAddr;
+ public string $protocol;
+ public string $method;
+ public string $uri;
+ public array $headers;
+ public array $cookies;
+ public array $uploads;
+ public array $attributes;
+ public array $query;
+ public ?string $body;
+ public bool $parsed;
+
+ /**
+ * @return string
+ */
+ public function getRemoteAddr(): string
+ {
+ return $this->attributes['ipAddress'] ?? $this->remoteAddr ?? '127.0.0.1';
+ }
+
+ /**
+ * @return array|null
+ */
+ public function getParsedBody(): ?array
+ {
+ if ($this->parsed) {
+ return json_decode($this->body, true);
+ }
+
+ return null;
+ }
+}