json body support
This commit is contained in:
@@ -39,7 +39,7 @@ require_once(dirname(__FILE__) . "/../authentication/OAuth10aAuthentication.php"
|
|||||||
require_once(dirname(__FILE__) . "/../authentication/OAuth2Authentication.php");
|
require_once(dirname(__FILE__) . "/../authentication/OAuth2Authentication.php");
|
||||||
|
|
||||||
class HttpClient {
|
class HttpClient {
|
||||||
|
|
||||||
public static function doRequest($httpMethod, $url, $parameters,
|
public static function doRequest($httpMethod, $url, $parameters,
|
||||||
$authHandlers, $contentType = ContentType::FORM, $encodeJson = true) {
|
$authHandlers, $contentType = ContentType::FORM, $encodeJson = true) {
|
||||||
HttpUtils::cleanParameters($parameters);
|
HttpUtils::cleanParameters($parameters);
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
class HttpUtils {
|
class HttpUtils {
|
||||||
|
|
||||||
|
const JSON_PARAM_BODY = "88416847677069008618";
|
||||||
|
|
||||||
public static function cleanParameters(&$parameters) {
|
public static function cleanParameters(&$parameters) {
|
||||||
if ($parameters == null) {
|
if ($parameters == null) {
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
@@ -54,7 +56,7 @@ class HttpUtils {
|
|||||||
break;
|
break;
|
||||||
case ContentType::JSON:
|
case ContentType::JSON:
|
||||||
$headers[] = "Content-Type: application/json";
|
$headers[] = "Content-Type: application/json";
|
||||||
$data = $parameters;
|
$data = $parameters[JSON_PARAM_BODY];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new MashapeClientException(
|
throw new MashapeClientException(
|
||||||
|
|||||||
Reference in New Issue
Block a user