Skip to content

Commit

Permalink
bug #31542 [HttpClient] add missing argument check (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] add missing argument check

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Should save some time, sometimes.

Commits
-------

964acd9 [HttpClient] add missing argument check
  • Loading branch information
nicolas-grekas committed May 20, 2019
2 parents abefb53 + 964acd9 commit b5dfbef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Symfony/Component/HttpClient/ScopingHttpClient.php
Expand Up @@ -36,6 +36,10 @@ public function __construct(HttpClientInterface $client, array $defaultOptionsBy
$this->client = $client;
$this->defaultOptionsByRegexp = $defaultOptionsByRegexp;
$this->defaultRegexp = $defaultRegexp;

if (null !== $defaultRegexp && !isset($defaultOptionsByRegexp[$defaultRegexp])) {
throw new InvalidArgumentException(sprintf('No options are mapped to the provided "%s" default regexp.', $defaultRegexp));
}
}

public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], $regexp = null): self
Expand Down

0 comments on commit b5dfbef

Please sign in to comment.