Ejemplo n.º 1
0
 /**
  * Constructor, the only place to set all parameters of this Message/Request
  *
  * @param NULL|string $uri URI for the request, if any.
  * @param NULL|string $method HTTP method for the request, if any.
  * @param string|resource|StreamInterface $body Message body, if any.
  * @param array $headers Headers for the message, if any.
  * @param array $serverParams Server parameters, typically from $_SERVER
  * @param array $uploadedFiles Upload file information, a tree of UploadedFiles
  * @throws \InvalidArgumentException for any invalid value.
  */
 public function __construct($uri = null, $method = null, $body = 'php://input', array $headers = array(), array $serverParams = array(), array $uploadedFiles = null)
 {
     if ($uploadedFiles !== null) {
         $this->validateUploadedFiles($uploadedFiles);
     }
     parent::__construct($uri, $method, $body, $headers);
     $this->serverParams = $serverParams;
     $this->uploadedFiles = $uploadedFiles;
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @dataProvider headersWithUpperAndLowerCaseValuesDataProvider
  */
 public function headerCanBeRetrieved($header, $value, $expected)
 {
     $request = new Request(null, null, 'php://memory', [$header => $value]);
     $this->assertEquals([$expected], $request->getHeader(strtolower($header)));
     $this->assertEquals([$expected], $request->getHeader(strtoupper($header)));
 }
Ejemplo n.º 3
0
 /**
  * @test
  */
 public function getHeaderLineWithHostReturnsEmptyStringIfUriDoesNotContainHost()
 {
     $request = new Request(new Uri());
     $this->assertSame('', $request->getHeaderLine('host'));
 }