Skip to content

Commit 79383a1

Browse files
committed
formatting
1 parent 188f89f commit 79383a1

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,25 @@ public function withHeader(string $name, string $value)
8181
}
8282

8383
/**
84-
* Flush all the configured headers.
84+
* Add an authorization token for the request.
8585
*
86+
* @param string $token
87+
* @param string $type
8688
* @return $this
8789
*/
88-
public function flushHeaders()
90+
public function withToken(string $token, string $type = 'Bearer')
8991
{
90-
$this->defaultHeaders = [];
91-
92-
return $this;
92+
return $this->withHeader('Authorization', $type.' '.$token);
9393
}
9494

9595
/**
96-
* Add an authorization token for the request.
96+
* Flush all the configured headers.
9797
*
98-
* @param string $token
99-
* @param string|null $type
10098
* @return $this
10199
*/
102-
public function withToken(string $token, string $type = null)
100+
public function flushHeaders()
103101
{
104-
$this->defaultHeaders['Authorization'] = sprintf('%s %s', $type ?? 'Bearer', $token);
102+
$this->defaultHeaders = [];
105103

106104
return $this;
107105
}

0 commit comments

Comments
 (0)