From ef70d65ffcbbac7ca19db70e72c43496fe6c10a0 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Thu, 3 Apr 2014 12:17:47 -0400 Subject: [PATCH] Correcion en error de body en MULTIPART --- framework/src/Maveriks/Extension/Restler.php | 19 +++++++++++++++++++ framework/src/Maveriks/WebApplication.php | 17 ++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/framework/src/Maveriks/Extension/Restler.php b/framework/src/Maveriks/Extension/Restler.php index e4f043839..c60c3d163 100644 --- a/framework/src/Maveriks/Extension/Restler.php +++ b/framework/src/Maveriks/Extension/Restler.php @@ -3,6 +3,9 @@ namespace Maveriks\Extension; use Luracast\Restler\Defaults; use Luracast\Restler\Format\UrlEncodedFormat; +use ProcessMaker\Services\Api; +use Luracast\Restler\RestException; + /** * Class Restler * Extension Restler class to implement in ProcessMaker @@ -103,4 +106,20 @@ class Restler extends \Luracast\Restler\Restler } return $includeQueryParameters ? $get : array(); //no body } + + /** + * This method call the function message + * + * @param RestException $e. Exception the error + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return void + */ + public function setMessage(RestException $e) + { + $this->message($e); + } } \ No newline at end of file diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 81e13a50d..93a776bf0 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -1,7 +1,9 @@ setMessage(new RestException(Api::STAT_APP_EXCEPTION, "Invalid Request, multipart without body.")); + exit(); + } else { + $input = json_decode($stringInput); + if (empty($input->calls)) { + $rest = new \Maveriks\Extension\Restler(); + $rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, "Invalid Request, multipart body without calls.")); + exit(); + } } - $input = json_decode($stringInput); + $baseUrl = (empty($input->base_url)) ? $uri : $input->base_url; foreach($input->calls as $value) {