Code complete on API.
This commit is contained in:
parent
1e140d1a09
commit
78c8ed42ac
4 changed files with 117 additions and 6 deletions
|
@ -11,12 +11,13 @@ class APIv1 extends CustomModule
|
|||
$response_code = 200;
|
||||
$error = 'An unexcepted error has occurred.';
|
||||
|
||||
echo($_SERVER['REQUEST_METHOD']);
|
||||
print_r($this->request_methods);
|
||||
if (!is_array($this->request_methods))
|
||||
{
|
||||
$this->request_methods = array($this->request_methods);
|
||||
}
|
||||
|
||||
// Checks the request method
|
||||
if ((is_array($this->request_methods) && !in_array($_SERVER['REQUEST_METHOD'], $this->request_methods))
|
||||
|| $this->request_methods != $_SERVER['REQUEST_METHOD'])
|
||||
if (!in_array($_SERVER['REQUEST_METHOD'], $this->request_methods))
|
||||
{
|
||||
$response_code = 400;
|
||||
$error = 'Invalid request method.';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue