示例#1
0
 /**
  * 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;
}