Skip to content

Commit e0587df

Browse files
authored
[11.x] Add withoutHeader() test method (#52309)
* Add withoutHeader test method * Update docblock comment
1 parent 394a6db commit e0587df

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ public function withHeader(string $name, string $value)
9090
return $this;
9191
}
9292

93+
/**
94+
* Remove a header from the request.
95+
*
96+
* @param string $name
97+
* @return $this
98+
*/
99+
public function withoutHeader(string $name)
100+
{
101+
unset($this->defaultHeaders[$name]);
102+
103+
return $this;
104+
}
105+
93106
/**
94107
* Add an authorization token for the request.
95108
*
@@ -121,9 +134,7 @@ public function withBasicAuth(string $username, string $password)
121134
*/
122135
public function withoutToken()
123136
{
124-
unset($this->defaultHeaders['Authorization']);
125-
126-
return $this;
137+
return $this->withoutHeader('Authorization');
127138
}
128139

129140
/**

0 commit comments

Comments
 (0)