Skip to content

Commit

Permalink
Merge pull request #70 from staabm/patch-1
Browse files Browse the repository at this point in the history
Added REQUEST_TIME_FLOAT server var
  • Loading branch information
mnapoli authored Oct 8, 2018
2 parents 3e538c0 + 21c8f7c commit 94a676a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Bridge/Psr7/RequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static function fromLambdaEvent(array $event) : ServerRequestInterface
'SERVER_PROTOCOL' => $protocolVersion,
'REQUEST_METHOD' => $method,
'REQUEST_TIME' => $event['requestContext']['requestTimeEpoch'] ?? time(),
'REQUEST_TIME_FLOAT' => microtime(true),
'QUERY_STRING' => $queryString,
'DOCUMENT_ROOT' => getcwd(),
'REQUEST_URI' => $uri,
Expand Down
2 changes: 2 additions & 0 deletions tests/Bridge/Psr7/RequestFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public function test create basic request()
self::assertEquals([], $request->getAttributes());
$serverParams = $request->getServerParams();
unset($serverParams['DOCUMENT_ROOT']);
// there is no aws lambda native reqestContext key with microsecond precision, therefore ignore it.
unset($serverParams['REQUEST_TIME_FLOAT']);
self::assertEquals([
'SERVER_PROTOCOL' => '1.1',
'REQUEST_METHOD' => 'GET',
Expand Down

0 comments on commit 94a676a

Please sign in to comment.