Skip to content

Commit 151cd17

Browse files
committed
Change method to withToken and allow overriding type
1 parent f9112ad commit 151cd17

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ public function flushHeaders()
9393
}
9494

9595
/**
96-
* Add a bearer token to the request headers.
96+
* Add an authorization token for the request.
9797
*
98-
* @param string $value
98+
* @param string $token
99+
* @param string $type
99100
* @return $this
100101
*/
101-
public function withBearerToken(string $value)
102+
public function withToken(string $token, string $type = 'Bearer')
102103
{
103-
$this->defaultHeaders['Authorization'] = 'Bearer '.$value;
104+
$this->defaultHeaders['Authorization'] = trim($type.' '.$token);
104105

105106
return $this;
106107
}

0 commit comments

Comments
 (0)