Skip to content

Commit ddaf185

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: Update .github/workflows/tests.yml Don't call class_exists() on null Added and improved Bulgarian translations PHP 8.1 must not cause the build to fail (yet) Add _run_tests bash function Add a GitHub Action for tests against PHP 8.1 [HttpClient] fix adding query string to relative URLs with scoped clients [Security] Added Ukrainian translations
2 parents 5573d1d + 653dc5e commit ddaf185

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ScopingHttpClient.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ public function request(string $method, string $url, array $options = []): Respo
7373
throw $e;
7474
}
7575

76-
$options = self::mergeDefaultOptions($options, $this->defaultOptionsByRegexp[$this->defaultRegexp], true);
76+
$defaultOptions = $this->defaultOptionsByRegexp[$this->defaultRegexp];
77+
$options = self::mergeDefaultOptions($options, $defaultOptions, true);
7778
if (\is_string($options['base_uri'] ?? null)) {
7879
$options['base_uri'] = self::parseUrl($options['base_uri']);
7980
}
80-
$url = implode('', self::resolveUrl($url, $options['base_uri'] ?? null));
81+
$url = implode('', self::resolveUrl($url, $options['base_uri'] ?? null, $defaultOptions['query'] ?? []));
8182
}
8283

8384
foreach ($this->defaultOptionsByRegexp as $regexp => $defaultOptions) {

Tests/ScopingHttpClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public function testRelativeUrl()
3030
public function testRelativeUrlWithDefaultRegexp()
3131
{
3232
$mockClient = new MockHttpClient();
33-
$client = new ScopingHttpClient($mockClient, ['.*' => ['base_uri' => 'http://example.com']], '.*');
33+
$client = new ScopingHttpClient($mockClient, ['.*' => ['base_uri' => 'http://example.com', 'query' => ['a' => 'b']]], '.*');
3434

35-
$this->assertSame('http://example.com/foo', $client->request('GET', '/foo')->getInfo('url'));
35+
$this->assertSame('http://example.com/foo?f=g&a=b', $client->request('GET', '/foo?f=g')->getInfo('url'));
3636
}
3737

3838
/**

0 commit comments

Comments
 (0)