Skip to content

Commit

Permalink
Merge pull request #8 from MarioDevment/fix/sanitize-headers
Browse files Browse the repository at this point in the history
Sanitize headers
  • Loading branch information
rgdevment authored Feb 14, 2020
2 parents 8750ce0 + 22e2919 commit f88e054
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ResponseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

class ResponseBuilder
{
protected const UPPER = '_ABCDEFGHIJKLMNOPQRSTUVWXYZ';
protected const LOWER = '-abcdefghijklmnopqrstuvwxyz';

/** @var MockBuilder */
private $mockBuilder;

Expand Down Expand Up @@ -49,7 +52,9 @@ public function callback(Closure $callback) : self

public function header(string $header, string $value) : self
{
$this->response = $this->response->withHeader($header, $value);
/** sanitize headers **/
$key = strtr($header, self::UPPER, self::LOWER);
$this->response = $this->response->withHeader($key, $value);

return $this;
}
Expand Down

0 comments on commit f88e054

Please sign in to comment.