Skip to content

Commit

Permalink
Add header method
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Jan 25, 2021
1 parent 975e1c5 commit a3f2155
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,34 @@ public function setDebugHeaders()

if($timing->hasTimings())
{
$this->setHeader($timing);
$this->addHeader($timing);
}
}
}

/**
* Set a header, defaulting to replace the existing
*
* @param Header $header
* @param bool $replace
*
* @return $this
*/
public function setHeader(Header $header, bool $replace = true)
{
$this->headers->set($header->getKey(), $header->getValue(), $replace);
return $this;
}

/**
* Add a header, without replacing existing
*
* @param Header $header
*
* @return $this
*/
public function addHeader(Header $header)
{
return $this->setHeader($header, false);
}
}

0 comments on commit a3f2155

Please sign in to comment.