예제 #1
0
파일: Endpoints.php 프로젝트: kris-nova/API
 /**
  * Will run the request
  */
 public function runBuildRequest()
 {
     try {
         $this->request = new Request();
         $this->request->process();
         http_response_code($this->request->response->code);
         print_r(json_encode($this->request->response));
     } catch (Exception $e) {
         $response = new Response();
         $response->body = $e->getMessage();
         $response->code = $e->getCode();
         print_r(json_encode($response));
     }
 }
예제 #2
0
파일: Request.php 프로젝트: kris-nova/API
<?php

use API\src\Config\Config;
use API\src\Request\Request;
require_once __DIR__ . '/../Autoload.php';
/*
 * Create new request
 */
$request = new Request();
/*
 * Build mock request
 */
$request->body = '{}';
$request->protocol = p_http;
$request->status = s_new;
$request->isAuthenticated = true;
$request->type = t_json;
$request->headers = array();
$request->endpoint = 'Auth/Login';
$request->verb = v_post;
/*
 * Send
 */
try {
    $request->process();
    //We get here, win request
    die('win');
} catch (Exception $e) {
    print_r($e->getMessage() . PHP_EOL);
    die;
}