summaryrefslogtreecommitdiff
path: root/src/PSR7Client.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/PSR7Client.php')
-rw-r--r--src/PSR7Client.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/PSR7Client.php b/src/PSR7Client.php
index e0be34a2..350637e2 100644
--- a/src/PSR7Client.php
+++ b/src/PSR7Client.php
@@ -32,6 +32,8 @@ class PSR7Client
/*** @var UploadedFileFactoryInterface */
private $uploadsFactory;
+ private $originalServer = [];
+
/** @var array Valid values for HTTP protocol version */
private static $allowedVersions = ['1.0', '1.1', '2',];
@@ -51,6 +53,7 @@ class PSR7Client
$this->requestFactory = $requestFactory ?? new Diactoros\ServerRequestFactory();
$this->streamFactory = $streamFactory ?? new Diactoros\StreamFactory();
$this->uploadsFactory = $uploadsFactory ?? new Diactoros\UploadedFileFactory();
+ $this->originalServer = $_SERVER;
}
/**
@@ -129,6 +132,8 @@ class PSR7Client
$response->getBody()->__toString(),
json_encode(['status' => $response->getStatusCode(), 'headers' => $headers])
);
+
+ $_SERVER = $this->originalServer;
}
/**
@@ -140,7 +145,7 @@ class PSR7Client
*/
protected function configureServer(array $ctx): array
{
- $server = $_SERVER;
+ $server = $this->originalServer;
$server['REQUEST_TIME'] = time();
$server['REQUEST_TIME_FLOAT'] = microtime(true);
$server['REMOTE_ADDR'] = $ctx['attributes']['ipAddress'] ?? $ctx['remoteAddr'] ?? '127.0.0.1';