Page MenuHomeDevCentral

D1293.id3321.diff
No OneTemporary

D1293.id3321.diff

Index: src/BaseService.php
===================================================================
--- src/BaseService.php
+++ src/BaseService.php
@@ -22,8 +22,9 @@
}
}
- protected function sendSuccessResponse () {
+ protected function sendSuccessResponse ($responseBody = '') {
// HTTP 200 OK
+ echo $responseBody;
}
protected function sendInvalidMethodResponse () {
Index: src/Service.php
===================================================================
--- src/Service.php
+++ 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

Mime Type
text/plain
Expires
Sun, Nov 24, 14:26 (5 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260366
Default Alt Text
D1293.id3321.diff (1 KB)

Event Timeline