Skip to content

Commit

Permalink
[11.x] Add withoutHeader() test method (#52309)
Browse files Browse the repository at this point in the history
* Add withoutHeader test method

* Update docblock comment
  • Loading branch information
gdebrauwer authored Jul 30, 2024
1 parent 394a6db commit e0587df
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ public function withHeader(string $name, string $value)
return $this;
}

/**
* Remove a header from the request.
*
* @param string $name
* @return $this
*/
public function withoutHeader(string $name)
{
unset($this->defaultHeaders[$name]);

return $this;
}

/**
* Add an authorization token for the request.
*
Expand Down Expand Up @@ -121,9 +134,7 @@ public function withBasicAuth(string $username, string $password)
*/
public function withoutToken()
{
unset($this->defaultHeaders['Authorization']);

return $this;
return $this->withoutHeader('Authorization');
}

/**
Expand Down

0 comments on commit e0587df

Please sign in to comment.