Merged in cochalo/processmaker (pull request #369)
Correcion en error de body en MULTIPART
This commit is contained in:
@@ -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) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMessage(RestException $e)
|
||||
{
|
||||
$this->message($e);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ namespace Maveriks;
|
||||
|
||||
use Maveriks\Util;
|
||||
use ProcessMaker\Services;
|
||||
use ProcessMaker\Services\Api;
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
class WebApplication
|
||||
{
|
||||
@@ -106,10 +108,19 @@ class WebApplication
|
||||
public function multipart($uri, $version = "1.0")
|
||||
{
|
||||
$stringInput = file_get_contents('php://input');
|
||||
if (is_null($stringInput)) {
|
||||
return array(); //no body
|
||||
if (empty($stringInput)) {
|
||||
$rest = new \Maveriks\Extension\Restler();
|
||||
$rest->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) {
|
||||
|
||||
Reference in New Issue
Block a user