Skip to content

Commit

Permalink
request add header (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvb91 authored Nov 11, 2023
1 parent a7b2f66 commit 91fe021
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/Headers/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ class Request implements Arrayable
*/
private array $delete = [];

/**
* @var array<string, string[]>
*/
private array $add = [];


/**
* @param string $name
* @param string[] $values
* @return $this
*/
public function addHeader(string $name, array $values): static
{
$this->add[$name] = $values;

return $this;
}

public function addDeleteHeader(string $header): static
{
$this->delete[] = $header;
Expand All @@ -30,6 +48,10 @@ public function toArray(): array
$array['delete'] = $this->delete;
}

if (count($this->add)) {
$array['add'] = $this->add;
}

return $array;
}
}

0 comments on commit 91fe021

Please sign in to comment.