From 66633cf78b1cd45ed57b129b129ea42218d45691 Mon Sep 17 00:00:00 2001 From: thefosk Date: Thu, 15 Nov 2012 16:50:13 -0800 Subject: [PATCH] json body support --- main/mashape/http/HttpClient.php | 2 +- main/mashape/http/HttpUtils.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main/mashape/http/HttpClient.php b/main/mashape/http/HttpClient.php index 6a3e004..bc10265 100755 --- a/main/mashape/http/HttpClient.php +++ b/main/mashape/http/HttpClient.php @@ -39,7 +39,7 @@ require_once(dirname(__FILE__) . "/../authentication/OAuth10aAuthentication.php" require_once(dirname(__FILE__) . "/../authentication/OAuth2Authentication.php"); class HttpClient { - + public static function doRequest($httpMethod, $url, $parameters, $authHandlers, $contentType = ContentType::FORM, $encodeJson = true) { HttpUtils::cleanParameters($parameters); diff --git a/main/mashape/http/HttpUtils.php b/main/mashape/http/HttpUtils.php index af1c57f..c0650b3 100644 --- a/main/mashape/http/HttpUtils.php +++ b/main/mashape/http/HttpUtils.php @@ -26,6 +26,8 @@ class HttpUtils { + const JSON_PARAM_BODY = "88416847677069008618"; + public static function cleanParameters(&$parameters) { if ($parameters == null) { $parameters = array(); @@ -54,7 +56,7 @@ class HttpUtils { break; case ContentType::JSON: $headers[] = "Content-Type: application/json"; - $data = $parameters; + $data = $parameters[JSON_PARAM_BODY]; break; default: throw new MashapeClientException(