Bluz\Response\Response::addHeader PHP Method

addHeader() public method

Existing values for the specified header will be maintained. The new value will be appended to the existing list.
public addHeader ( string $header, string $value ) : void
$header string header name to add
$value string value of the header
return void
    public function addHeader($header, $value)
    {
        if ($this->hasHeader($header)) {
            $this->headers[$header][] = $value;
        } else {
            $this->setHeader($header, $value);
        }
    }

Usage Example

Example #1
0
 /**
  * @covers \Bluz\Response\Response::removeHeaders
  */
 public function testRemoveHeaders()
 {
     $this->response->addHeader('foo', 'bar');
     $this->response->addHeader('baz', 'qux');
     $this->response->removeHeaders();
     $this->assertFalse($this->response->hasHeader('foo'));
     $this->assertFalse($this->response->hasHeader('baz'));
 }