diff --git a/src/ClientResolver.php b/src/ClientResolver.php index 8e22f18b5c..efd015b877 100644 --- a/src/ClientResolver.php +++ b/src/ClientResolver.php @@ -1030,6 +1030,7 @@ public static function _apply_endpoint($value, array &$args, HandlerList $list) return; } + $args['endpoint_override'] = true; $args['endpoint'] = $value; } diff --git a/src/UserAgentMiddleware.php b/src/UserAgentMiddleware.php index bc6f1683ad..e98b2a2cdc 100644 --- a/src/UserAgentMiddleware.php +++ b/src/UserAgentMiddleware.php @@ -276,7 +276,7 @@ private function getMetrics(): string */ private function appendEndpointMetric(): void { - if (!empty($this->args['endpoint'])) { + if (!empty($this->args['endpoint_override'])) { $this->metricsBuilder->append(MetricsBuilder::ENDPOINT_OVERRIDE); } } diff --git a/tests/UserAgentMiddlewareTest.php b/tests/UserAgentMiddlewareTest.php index 4362d49fb4..1eb7403457 100644 --- a/tests/UserAgentMiddlewareTest.php +++ b/tests/UserAgentMiddlewareTest.php @@ -204,7 +204,8 @@ public function userAgentCasesDataProvider(): \Generator 'metricsWithEndpoint' => function (): array { $expectedEndpoint = "https://foo-endpoint.com"; $args = [ - 'endpoint' => $expectedEndpoint + 'endpoint' => $expectedEndpoint, + 'endpoint_override' => true, ]; return [$args, 'm/' . MetricsBuilder::ENDPOINT_OVERRIDE];