8000 base 64 -> base64 and updated test · symfony/symfony@8fb7e41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fb7e41

Browse files
base 64 -> base64 and updated test
1 parent 8699f9b commit 8fb7e41

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Component/HttpClient/HttpClientTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
111111
}
112112

113113
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._=:~+/0-9a-zA-Z]++$}', $options['auth_bearer']))) {
114-
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet and colons, '.(\is_string($options['auth_bearer']) ? 'invalid string given.' : '"%s" given.'), \gettype($options['auth_bearer'])));
114+
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base64 alphabet and colons, '.(\is_string($options['auth_bearer']) ? 'invalid string given.' : '"%s" given.'), \gettype($options['auth_bearer'])));
115115
}
116116

117117
if (isset($options['auth_basic'], $options['auth_bearer'])) {

src/Symfony/Component/HttpClient/Tests/HttpClientTraitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ public function testAuthBearerOption()
179179
public function testInvalidAuthBearerOption()
180180
{
181181
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
182-
$this->expectExceptionMessage('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, "object" given.');
182+
$this->expectExceptionMessage('Option "auth_bearer" must be a string containing only characters from the base64 alphabet and colons, "object" given.');
183183
self::prepareRequest('POST', 'http://example.com', ['auth_bearer' => new \stdClass()], HttpClientInterface::OPTIONS_DEFAULTS);
184184
}
185185

186186
public function testInvalidAuthBearerValue()
187187
{
188188
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
189-
$this->expectExceptionMessage('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, invalid string given.');
189+
$this->expectExceptionMessage('Option "auth_bearer" must be a string containing only characters from the base64 alphabet and colons, invalid string given.');
190190
self::prepareRequest('POST', 'http://example.com', ['auth_bearer' => "a\nb"], HttpClientInterface::OPTIONS_DEFAULTS);
191191
}
192192

0 commit comments

Comments
 (0)
0