From cf0e604cb41373a9f2f594f8e31f2531e79649e8 Mon Sep 17 00:00:00 2001 From: Michael Roterman Date: Mon, 24 Feb 2014 00:34:55 +0100 Subject: [PATCH] Refactoring ApiTokenPlugin --- lib/Tmdb/HttpClient/Plugin/ApiTokenPlugin.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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); } }