Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769211
D1293.id3325.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.id3325.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, 13:39 (8 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260061
Default Alt Text
D1293.id3325.diff (1 KB)
Attached To
Mode
D1293: Add /status entry point
Attached
Detach File
Event Timeline
Log In to Comment