Skip to content

Commit 9897e3f

Browse files
committed
Add withBearerToken method
1 parent cf2644f commit 9897e3f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@ public function flushHeaders()
9292
return $this;
9393
}
9494

95+
/**
96+
* Add a bearer token to the request headers.
97+
*
98+
* @param string $value
99+
* @return $this
100+
*/
101+
public function withBearerToken(string $value)
102+
{
103+
$this->defaultHeaders['Authorization'] = 'Bearer '.$value;
104+
105+
return $this;
106+
}
107+
95108
/**
96109
* Define a set of server variables to be sent with the requests.
97110
*

0 commit comments

Comments
 (0)