Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3768888
D1293.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D1293.diff
View Options
diff --git a/src/BaseService.php b/src/BaseService.php
--- a/src/BaseService.php
+++ b/src/BaseService.php
@@ -22,8 +22,9 @@
}
}
- protected function sendSuccessResponse () {
+ protected function sendSuccessResponse ($responseBody = '') {
// HTTP 200 OK
+ echo $responseBody;
}
protected function sendInvalidMethodResponse () {
diff --git a/src/Service.php b/src/Service.php
--- a/src/Service.php
+++ b/src/Service.php
@@ -18,15 +18,22 @@
/// Controller
///
- public function handle () : void {
- $body = $this->getBodyObject();
+ private function isAliveRequest() : bool {
+ return
+ $_SERVER['REQUEST_METHOD'] === "GET"
+ &&
+ $_SERVER['REQUEST_URI'] === '/status';
+ }
- if ($_SERVER['REQUEST_METHOD'] === "PUT") {
+ public function handle () : void {
+ if ($this->isAliveRequest()) {
+ $this->sendSuccessResponse("ALIVE");
+ } elseif ($_SERVER['REQUEST_METHOD'] === "PUT") {
+ $body = $this->getBodyObject();
$this->put($body);
- return;
+ } else {
+ $this->sendInvalidMethodResponse();
}
-
- $this->sendInvalidMethodResponse();
}
public function put ($data) : void {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 11:13 (13 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260061
Default Alt Text
D1293.diff (1 KB)
Attached To
Mode
D1293: Add /status entry point
Attached
Detach File
Event Timeline
Log In to Comment