diff --git a/src/Client.php b/src/Client.php index 36e7e9f..9c602cf 100644 --- a/src/Client.php +++ b/src/Client.php @@ -192,6 +192,7 @@ public function initRequest(string $method, string $path, array $options = []): $body = new SwooleStream($content); $request = new Psr7Request($method, $uri, $headers, $body); + $request->setServerParams($this->getServerParams($method, $uri->getPath())); return $request->withQueryParams($query) ->withParsedBody($data) @@ -285,4 +286,20 @@ protected function getStream(string $resource) return $stream; } + + protected function getServerParams(string $method, string $uri): array + { + return [ + 'request_method' => $method, + 'request_uri' => $uri, + 'path_info' => $uri, + 'request_time' => time(), + 'request_time_float' => microtime(true), + 'server_protocol' => 'HTTP/1.1', + 'server_port' => 9501, + 'remote_port' => 40005, + 'remote_addr' => '127.0.0.1', + 'master_time' => time(), + ]; + } }