diff options
| -rw-r--r-- | index.php | 2 | ||||
| -rw-r--r-- | private/Model/Query.php | 2 | ||||
| -rw-r--r-- | private/View/Main.php | 21 |
3 files changed, 18 insertions, 7 deletions
@@ -24,7 +24,7 @@ use AugustOffensive\View; use AugustOffensive\Controller; // configure content type before anything is output -header("Content-Type: application/" + View\Main::TYPE); +header("Content-Type: application/" . View\Main::TYPE); try { // initiate connection and build front-end diff --git a/private/Model/Query.php b/private/Model/Query.php index df05b24..7eca836 100644 --- a/private/Model/Query.php +++ b/private/Model/Query.php @@ -54,7 +54,7 @@ class Query * * @return string */ - public function get_request (): string + public function getRequest (): string { return $this->request; } diff --git a/private/View/Main.php b/private/View/Main.php index 746c2bb..b693979 100644 --- a/private/View/Main.php +++ b/private/View/Main.php @@ -19,7 +19,7 @@ class Main private $result; /** @var string TYPE The type of output the client should receive. */ - private const TYPE = "json"; + public const TYPE = "json"; /** * Prepares the output and environment for the front end of the service. @@ -65,10 +65,21 @@ class Main */ public function generateResult (): string { - $this->result = Controller\Controller::createResult( - "", - array() - ); + switch (strtolower($this->query->getPath()[1])) { + case "callback": + $this->result = Controller\Controller::createResult( + "CALLBACK", + array( + "path" => $this->query->getPath(), + "request" => $this->query->getRequest(), + "content" => $this->query->getContent() + ) + ); + break; + default: + $this->result = Controller\Controller::createResult("", array()); + break; + } return self::generateOutput($this->result); } |
