FIX: Fixes #70 Added extension points for GET requests

- MINOR: Fixed typos
This commit is contained in:
User for performing fabric deployments 2019-05-07 14:08:32 +12:00
parent 489f8c576f
commit 498402389c

View File

@ -300,6 +300,8 @@ class RestfulServer extends Controller
} }
} }
$responseFormatter->setTotalSize($objs->count()); $responseFormatter->setTotalSize($objs->count());
$this->extend('updateRestfulGetHandler', $objs, $responseFormatter);
return $responseFormatter->convertDataObjectSet($objs, $fields); return $responseFormatter->convertDataObjectSet($objs, $fields);
} }
@ -308,6 +310,8 @@ class RestfulServer extends Controller
return $responseFormatter->convertDataObjectSet(new ArrayList(), $fields); return $responseFormatter->convertDataObjectSet(new ArrayList(), $fields);
} }
$this->extend('updateRestfulGetHandler', $obj, $responseFormatter);
return $responseFormatter->convertDataObject($obj, $fields); return $responseFormatter->convertDataObject($obj, $fields);
} }
@ -712,10 +716,10 @@ class RestfulServer extends Controller
$this->getResponse()->addHeader('WWW-Authenticate', 'Basic realm="API Access"'); $this->getResponse()->addHeader('WWW-Authenticate', 'Basic realm="API Access"');
$this->getResponse()->addHeader('Content-Type', 'text/plain'); $this->getResponse()->addHeader('Content-Type', 'text/plain');
$reponse = "You don't have access to this item through the API."; $response = "You don't have access to this item through the API.";
$this->extend(__FUNCTION__, $reponse); $this->extend(__FUNCTION__, $response);
return $reponse; return $response;
} }
/** /**
@ -727,10 +731,10 @@ class RestfulServer extends Controller
$this->getResponse()->setStatusCode(404); $this->getResponse()->setStatusCode(404);
$this->getResponse()->addHeader('Content-Type', 'text/plain'); $this->getResponse()->addHeader('Content-Type', 'text/plain');
$reponse = "That object wasn't found"; $response = "That object wasn't found";
$this->extend(__FUNCTION__, $reponse); $this->extend(__FUNCTION__, $response);
return $reponse; return $response;
} }
/** /**
@ -741,10 +745,10 @@ class RestfulServer extends Controller
$this->getResponse()->setStatusCode(405); $this->getResponse()->setStatusCode(405);
$this->getResponse()->addHeader('Content-Type', 'text/plain'); $this->getResponse()->addHeader('Content-Type', 'text/plain');
$reponse = "Method Not Allowed"; $response = "Method Not Allowed";
$this->extend(__FUNCTION__, $reponse); $this->extend(__FUNCTION__, $response);
return $reponse; return $response;
} }
/** /**
@ -755,10 +759,10 @@ class RestfulServer extends Controller
$this->response->setStatusCode(415); // Unsupported Media Type $this->response->setStatusCode(415); // Unsupported Media Type
$this->getResponse()->addHeader('Content-Type', 'text/plain'); $this->getResponse()->addHeader('Content-Type', 'text/plain');
$reponse = "Unsupported Media Type"; $response = "Unsupported Media Type";
$this->extend(__FUNCTION__, $reponse); $this->extend(__FUNCTION__, $response);
return $reponse; return $response;
} }
/** /**