Skip to content

Commit

Permalink
[HttpClient] Don't prepare the request in ScopingHttpClient
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed May 10, 2021
1 parent 2640207 commit 7bac9c0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ScopingHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static function forBaseUri(HttpClientInterface $client, string $baseUri,
*/
public function request(string $method, string $url, array $options = []): ResponseInterface
{
$e = null;
$url = self::parseUrl($url, $options['query'] ?? []);

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

[$url, $options] = self::prepareRequest($method, implode('', $url), $options, $this->defaultOptionsByRegexp[$this->defaultRegexp], true);
$url = implode('', $url);
$options = self::mergeDefaultOptions($options, $this->defaultOptionsByRegexp[$this->defaultRegexp], true);
if (\is_string($options['base_uri'] ?? null)) {
$options['base_uri'] = self::parseUrl($options['base_uri']);
}
$url = implode('', self::resolveUrl($url, $options['base_uri'] ?? null));
}

foreach ($this->defaultOptionsByRegexp as $regexp => $defaultOptions) {
if (preg_match("{{$regexp}}A", $url)) {
$options = self::mergeDefaultOptions($options, $defaultOptions, true);
if (null === $e || $regexp !== $this->defaultRegexp) {
$options = self::mergeDefaultOptions($options, $defaultOptions, true);
}
break;
}
}
Expand Down

0 comments on commit 7bac9c0

Please sign in to comment.