From 8ecd32c0b989ac34f85a4aea4fccfd9cca80ef2f Mon Sep 17 00:00:00 2001 From: zemonstas Date: Wed, 11 Jun 2014 14:50:51 +1000 Subject: [PATCH 1/3] Fix post function in Client.php Using correct json_encode arguments. getParams breaks because it isn't JSON. --- src/Phpforce/RestClient/Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Phpforce/RestClient/Client.php b/src/Phpforce/RestClient/Client.php index 2a0ce69..b1e3cf8 100644 --- a/src/Phpforce/RestClient/Client.php +++ b/src/Phpforce/RestClient/Client.php @@ -58,7 +58,7 @@ public function post($uri, array $arguments = array()) { $request = $this->getClient()->post($uri); $request->setHeader('Authorization', 'Bearer ' . $this->getSessionId()); - $request->getParams()->merge($arguments); + $request->setBody(json_encode($arguments), 'application/json'); $response = $request->send(); @@ -99,4 +99,4 @@ protected function getSessionId() { return $this->getLoginResult()->getSessionId(); } -} \ No newline at end of file +} From b7f7911a5e60b04da569f4d29f82d7c641e02d15 Mon Sep 17 00:00:00 2001 From: zemonstas Date: Wed, 11 Jun 2014 14:56:46 +1000 Subject: [PATCH 2/3] Reverted Client.php in preparation to making a branch --- src/Phpforce/RestClient/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Phpforce/RestClient/Client.php b/src/Phpforce/RestClient/Client.php index b1e3cf8..3b1d1f3 100644 --- a/src/Phpforce/RestClient/Client.php +++ b/src/Phpforce/RestClient/Client.php @@ -58,7 +58,7 @@ public function post($uri, array $arguments = array()) { $request = $this->getClient()->post($uri); $request->setHeader('Authorization', 'Bearer ' . $this->getSessionId()); - $request->setBody(json_encode($arguments), 'application/json'); + $request->getParams()->merge($arguments); $response = $request->send(); From c1fbf206d21d543d2cb73c9481e44e55075f2c54 Mon Sep 17 00:00:00 2001 From: zemonstas Date: Wed, 11 Jun 2014 14:57:40 +1000 Subject: [PATCH 3/3] Fix post function in Client.php Using correct json_encode arguments. getParams breaks because it isn't JSON. --- src/Phpforce/RestClient/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Phpforce/RestClient/Client.php b/src/Phpforce/RestClient/Client.php index 3b1d1f3..b1e3cf8 100644 --- a/src/Phpforce/RestClient/Client.php +++ b/src/Phpforce/RestClient/Client.php @@ -58,7 +58,7 @@ public function post($uri, array $arguments = array()) { $request = $this->getClient()->post($uri); $request->setHeader('Authorization', 'Bearer ' . $this->getSessionId()); - $request->getParams()->merge($arguments); + $request->setBody(json_encode($arguments), 'application/json'); $response = $request->send();