Skip to content

Commit abae6bc

Browse files
dunglasfabpot
authored andcommitted
[HttpClient] Add new bearer option
1 parent d2ba50f commit abae6bc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

HttpClientInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
interface HttpClientInterface
2727
{
2828
public const OPTIONS_DEFAULTS = [
29-
'auth' => null, // string - a username:password enabling HTTP Basic authentication
29+
'auth_basic' => null, // string - a username:password enabling HTTP Basic authentication (RFC 7617)
30+
'auth_bearer' => null, // string - a token enabling HTTP Bearer authorization (RFC 6750)
3031
'query' => [], // string[] - associative array of query string values to merge with the request's URL
3132
'headers' => [], // iterable|string[]|string[][] - headers names provided as keys or as part of values
3233
'body' => '', // array|string|resource|\Traversable|\Closure - the callback SHOULD yield a string

Test/HttpClientTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function testRedirects()
214214
{
215215
$client = $this->getHttpClient();
216216
$response = $client->request('POST', 'http://localhost:8057/301', [
217-
'auth' => 'foo:bar',
217+
'auth_basic' => 'foo:bar',
218218
'body' => function () {
219219
yield 'foo=bar';
220220
},
@@ -291,7 +291,7 @@ public function testMaxRedirects()
291291
$client = $this->getHttpClient();
292292
$response = $client->request('GET', 'http://localhost:8057/301', [
293293
'max_redirects' => 1,
294-
'auth' => 'foo:bar',
294+
'auth_basic' => 'foo:bar',
295295
]);
296296

297297
try {

0 commit comments

Comments
 (0)