8000 bug #41160 [HttpClient] Don't prepare the request in ScopingHttpClien… · symfony/symfony@132e09f · GitHub
[go: up one dir, main page]

Skip to content

Commit 132e09f

Browse files
bug #41160 [HttpClient] Don't prepare the request in ScopingHttpClient (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Don't prepare the request in ScopingHttpClient | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Spotted while working on #41159 (needed by it.) Commits ------- a53db83 [HttpClient] Don't prepare the request in ScopingHttpClient
2 parents be480d8 + a53db83 commit 132e09f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Symfony/Component/HttpClient/ScopingHttpClient.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public static function forBaseUri(HttpClientInterface $client, string $baseUri,
5757
*/
5858
public function request(string $method, string $url, array $options = []): ResponseInterface
5959
{
60+
$e = null;
6061
$url = self::parseUrl($url, $options['query'] ?? []);
6162

6263
if (\is_string($options['base_uri'] ?? null)) {
@@ -70,13 +71,18 @@ public function request(string $method, string $url, array $options = []): Respo
7071
throw $e;
7172
}
7273

73-
[$url, $options] = self::prepareRequest($method, implode('', $url), $options, $this->defaultOptionsByRegexp[$this->defaultRegexp], true);
74-
< 8000 span class=pl-c1>$url = implode('', $url);
74+
$options = self::mergeDefaultOptions($options, $this->defaultOptionsByRegexp[$this->defaultRegexp], true);
75+
if (\is_string($options['base_uri'] ?? null)) {
76+
$options['base_uri'] = self::parseUrl($options['base_uri']);
77+
}
78+
$url = implode('', self::resolveUrl($url, $options['base_uri'] ?? null));
7579
}
7680

7781
foreach ($this->defaultOptionsByRegexp as $regexp => $defaultOptions) {
7882
if (preg_match("{{$regexp}}A", $url)) {
79-
$options = self::mergeDefaultOptions($options, $defaultOptions, true);
83+
if (null === $e || $regexp !== $this->defaultRegexp) {
84+
$options = self::mergeDefaultOptions($options, $defaultOptions, true);
85+
}
8086
break;
8187
}
8288
}

0 commit comments

Comments
 (0)
0