Пример #1
0
 /**
  * Gets the request user agent
  *
  * @access public
  * @return string
  */
 public function userAgent()
 {
     return $this->headers->get('USER_AGENT');
 }
 public function testNameNormalizing()
 {
     // Test data
     $header = 'content_TYPE';
     // Ignore our deprecation error
     $old_error_val = error_reporting();
     error_reporting(E_ALL ^ E_USER_DEPRECATED);
     $normalized_key = HeaderDataCollection::normalizeName($header);
     $normalized_key_without_canonicalization = HeaderDataCollection::normalizeName($header, false);
     error_reporting($old_error_val);
     $this->assertNotSame($header, $normalized_key);
     $this->assertSame('content-type', $normalized_key);
     $this->assertSame('content-TYPE', $normalized_key_without_canonicalization);
 }
Пример #3
0
 /**
  * Sets a response header
  *
  * @param string $key       The name of the HTTP response header
  * @param mixed $value      The value to set the header with
  * @access public
  * @return Response
  */
 public function header($key, $value)
 {
     $this->headers->set($key, $value);
     return $this;
 }
 public function testNameNormalizing()
 {
     // Test data
     $data = array('DOG_NAME' => 'cooper');
     // Create our collection with NO data
     $normalized_key = HeaderDataCollection::normalizeName(key($data));
     $normalized_val = HeaderDataCollection::normalizeName(current($data));
     $this->assertNotSame(key($data), $normalized_key);
     $this->assertSame(current($data), $normalized_val);
     $normalized_key_without_case_change = HeaderDataCollection::normalizeName(key($data), false);
     $this->assertTrue(strpos($normalized_key_without_case_change, 'D') !== false);
     $this->assertTrue(strpos($normalized_key_without_case_change, 'd') === false);
     $this->assertTrue(strpos($normalized_key, 'd') !== false);
     $this->assertTrue(strpos($normalized_key, 'D') === false);
 }