FIX on 404 stating handling on API dispatching service
This commit is contained in:
@@ -1070,6 +1070,7 @@ class Bootstrap
|
||||
public function dispatchApiService($uri, $config, $apiClassesPath = '')
|
||||
{
|
||||
$rest = new Luracast\Restler\Restler();
|
||||
$rest->setAPIVersion('1.0');
|
||||
|
||||
$dataUri = explode('/', $uri);
|
||||
array_shift($dataUri);
|
||||
@@ -1079,18 +1080,17 @@ class Bootstrap
|
||||
$namespace = 'Services_Api_';
|
||||
$classFile = $apiDir . $namespace . $reqClass . '.php';
|
||||
|
||||
if (! file_exists($classFile)) {
|
||||
//throw new Luracast\Restler\RestException(404, "Invalid Service Request");
|
||||
$rest->handleError(404);
|
||||
die;
|
||||
$rest->setSupportedFormats('JsonFormat', 'XmlFormat');
|
||||
|
||||
if (file_exists($classFile)) {
|
||||
require_once $classFile;
|
||||
|
||||
$_SERVER['REQUEST_URI'] = $uri;
|
||||
$rest->addAPIClass($namespace . $reqClass);
|
||||
} else {
|
||||
$rest->handleError(500);
|
||||
}
|
||||
|
||||
require_once $classFile;
|
||||
|
||||
$_SERVER['REQUEST_URI'] = $uri;
|
||||
|
||||
$rest->setSupportedFormats('JsonFormat', 'XmlFormat');
|
||||
$rest->addAPIClass($namespace . $reqClass);
|
||||
$rest->handle();
|
||||
die;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user