Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 3, 2020
1 parent 188f89f commit 79383a1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,25 @@ public function withHeader(string $name, string $value)
}

/**
* Flush all the configured headers.
* Add an authorization token for the request.
*
* @param string $token
* @param string $type
* @return $this
*/
public function flushHeaders()
public function withToken(string $token, string $type = 'Bearer')
{
$this->defaultHeaders = [];

return $this;
return $this->withHeader('Authorization', $type.' '.$token);
}

/**
* Add an authorization token for the request.
* Flush all the configured headers.
*
* @param string $token
* @param string|null $type
* @return $this
*/
public function withToken(string $token, string $type = null)
public function flushHeaders()
{
$this->defaultHeaders['Authorization'] = sprintf('%s %s', $type ?? 'Bearer', $token);
$this->defaultHeaders = [];

return $this;
}
Expand Down

0 comments on commit 79383a1

Please sign in to comment.