Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Added test that improperly prefixed headers are not returned by marsh…
Browse files Browse the repository at this point in the history
…alHeadersFromSapi
  • Loading branch information
oauth2-middleware committed Dec 31, 2018
1 parent ac8213c commit 9e4176a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/ServerRequestFactoryTest.php
Expand Up @@ -60,6 +60,23 @@ public function testMarshalsExpectedHeadersFromServerArray()
$this->assertSame($expected, marshalHeadersFromSapi($server));
}

public function testMarshalInvalidHeadersStrippedFromServerArray()
{
$server = [
'COOKIE' => 'COOKIE',
'HTTP_AUTHORIZATION' => 'token',
'MD5' => 'CONTENT-MD5',
'CONTENT_LENGTH' => 'UNSPECIFIED',
];

//Headers that don't begin with HTTP_ or CONTENT_ will not be returned
$expected = [
'authorization' => 'token',
'content-length' => 'UNSPECIFIED',
];
$this->assertSame($expected, marshalHeadersFromSapi($server));
}

public function testMarshalsVariablesPrefixedByApacheFromServerArray()
{
// Non-prefixed versions will be preferred
Expand Down

0 comments on commit 9e4176a

Please sign in to comment.