remove() public method

Removes the specified header field
public remove ( string $name ) : void
$name string Name of the field
return void
 /**
  * @test
  */
 public function removeRemovesTheSpecifiedHeader()
 {
     $specifiedFields = array('X-Coffee' => 'Arabica', 'Host' => 'myhost.com');
     $headers = new Headers($specifiedFields);
     $headers->remove('X-Coffee');
     $headers->remove('X-This-Does-Not-Exist-Anyway');
     $this->assertEquals(['Host' => ['myhost.com']], $headers->getAll());
 }
Exemplo n.º 2
0
 /**
  * Allows to remove headers that were added with addAutomaticRequestHeader.
  *
  * @param string $name Name of the header, for example "Location", "Content-Description" etc.
  * @return void
  */
 public function removeAutomaticRequestHeader($name)
 {
     $this->automaticRequestHeaders->remove($name);
 }