summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-12-20 14:56:47 +0300
committerWolfy-J <[email protected]>2018-12-20 14:56:47 +0300
commitc63dd02f3ea0dfa326cfd20f259b235aca3fba1b (patch)
tree4feef09cc17c98d9acd295268737bb67cff0498d /src
parentea60c3e1eba96cd140e4c89b710de3a98f523f43 (diff)
added tests for USER_AGENT
Diffstat (limited to 'src')
-rw-r--r--src/PSR7Client.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/PSR7Client.php b/src/PSR7Client.php
index 129cb118..0b148884 100644
--- a/src/PSR7Client.php
+++ b/src/PSR7Client.php
@@ -144,7 +144,11 @@ class PSR7Client
$server['REQUEST_TIME_FLOAT'] = microtime(true);
$server['REMOTE_ADDR'] = $ctx['attributes']['ipAddress'] ?? $ctx['remoteAddr'] ?? '127.0.0.1';
$server['REMOTE_ADDR'] = $ctx['attributes']['ipAddress'] ?? $ctx['remoteAddr'] ?? '127.0.0.1';
- $server['HTTP_USER_AGENT'] = $ctx['headers']['User-Agent'][0] ?? '';
+
+ $server['HTTP_USER_AGENT'] = '';
+ if (isset($ctx['headers']['User-Agent'][0])) {
+ $server['HTTP_USER_AGENT'] = $ctx['headers']['User-Agent'][0];
+ }
return $server;
}