diff --git a/lib/Tmdb/HttpClient/Plugin/ApiTokenPlugin.php b/lib/Tmdb/HttpClient/Plugin/ApiTokenPlugin.php index b2bf4b14..dad5e992 100644 --- a/lib/Tmdb/HttpClient/Plugin/ApiTokenPlugin.php +++ b/lib/Tmdb/HttpClient/Plugin/ApiTokenPlugin.php @@ -37,11 +37,8 @@ public function onBeforeSend(Event $event) { $url = $event['request']->getUrl(true); - $origionalQuery = $url->getQuery(); - $newQuery = clone $origionalQuery; + $url->getQuery()->set('api_key', $this->token->getApiToken()); - $newQuery->set('api_key', $this->token->getApiToken()); - - $event['request']->setUrl($url->setQuery($newQuery)); + $event['request']->setUrl($url); } }