@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $router = new \LunixREST\Router\Router($accessControl, $throttle, $responseFactory, $endpointFactory); |
11 | 11 | |
12 | 12 | try { |
13 | - $request = \LunixREST\Request\Request::createFromURL("GET", [], [], '127.0.0.1', "/1/123456/phonenumbers/6517855237.json");// \LunixREST\Request\Request::createFromURL($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
13 | + $request = \LunixREST\Request\Request::createFromURL("GET", [], [], '127.0.0.1', "/1/123456/phonenumbers/6517855237.json");// \LunixREST\Request\Request::createFromURL($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
14 | 14 | |
15 | 15 | try { |
16 | 16 | $response = $router->route($request); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | header('500 Internal Server Error', true, 500); |
30 | 30 | } |
31 | 31 | } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
32 | - header('400 Bad Request', 400); |
|
32 | + header('400 Bad Request', 400); |
|
33 | 33 | } catch(Exception|Error $e){ |
34 | - header('500 Internal Server Error', true, 500); |
|
34 | + header('500 Internal Server Error', true, 500); |
|
35 | 35 | } |
@@ -11,26 +11,26 @@ |
||
11 | 11 | $router = new \LunixREST\Router\Router($accessControl, $throttle, $responseFactory, $endpointFactory); |
12 | 12 | |
13 | 13 | try { |
14 | - $request = \LunixREST\Request\Request::createFromURL("GET", [], [], '127.0.0.1', "/1.0/public/helloworld.json");// \LunixREST\Request\Request::createFromURL($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
14 | + $request = \LunixREST\Request\Request::createFromURL("GET", [], [], '127.0.0.1', "/1.0/public/helloworld.json");// \LunixREST\Request\Request::createFromURL($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
15 | 15 | |
16 | - try { |
|
17 | - $response = $router->route($request); |
|
18 | - echo $response->getAsString(); |
|
19 | - } catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){ |
|
20 | - header('400 Bad Request', true, 400); |
|
21 | - } catch(\LunixREST\Endpoint\Exceptions\UnknownEndpointException $e){ |
|
22 | - header('404 Not Found', true, 404); |
|
23 | - } catch(\LunixREST\Response\Exceptions\UnknownResponseTypeException $e){ |
|
24 | - header('404 Not Found', true, 404); |
|
25 | - } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
26 | - header('403 Access Denied', true, 403); |
|
27 | - } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
28 | - header('429 Too Many Requests', true, 429); |
|
29 | - } catch(Exception $e){ |
|
30 | - header('500 Internal Server Error', true, 500); |
|
31 | - } |
|
16 | + try { |
|
17 | + $response = $router->route($request); |
|
18 | + echo $response->getAsString(); |
|
19 | + } catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){ |
|
20 | + header('400 Bad Request', true, 400); |
|
21 | + } catch(\LunixREST\Endpoint\Exceptions\UnknownEndpointException $e){ |
|
22 | + header('404 Not Found', true, 404); |
|
23 | + } catch(\LunixREST\Response\Exceptions\UnknownResponseTypeException $e){ |
|
24 | + header('404 Not Found', true, 404); |
|
25 | + } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
26 | + header('403 Access Denied', true, 403); |
|
27 | + } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
28 | + header('429 Too Many Requests', true, 429); |
|
29 | + } catch(Exception $e){ |
|
30 | + header('500 Internal Server Error', true, 500); |
|
31 | + } |
|
32 | 32 | } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
33 | - header('400 Bad Request', true, 400); |
|
33 | + header('400 Bad Request', true, 400); |
|
34 | 34 | } catch(Exception $e){ |
35 | - header('500 Internal Server Error', true, 500); |
|
35 | + header('500 Internal Server Error', true, 500); |
|
36 | 36 | } |