diff --git a/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php b/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php index 7834476953e5..85eabee130b6 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php +++ b/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php @@ -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. * @@ -121,9 +134,7 @@ public function withBasicAuth(string $username, string $password) */ public function withoutToken() { - unset($this->defaultHeaders['Authorization']); - - return $this; + return $this->withoutHeader('Authorization'); } /**