mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
HTTP basic authentication
Set this as default authentication, providing codeception test case
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
/**
|
||||
* Testing class for REST calls and authentication
|
||||
*/
|
||||
class Test extends REST_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test HTTP GET method
|
||||
* It responses whith the HTTP status 200 and prints this JSON string
|
||||
* {"success":true,"message":"API HTTP GET call test succeed"}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get()
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
'message' => 'API HTTP GET call test succeed'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test HTTP POST method
|
||||
* * It responses whith the HTTP status 200 and prints this JSON string
|
||||
* {"success":true,"message":"API HTTP POST call test succeed"}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_post()
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
'message' => 'API HTTP POST call test succeed'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user