@@ -9,27 +9,27 @@ |
||
9 | 9 | $router = new \LunixREST\Router\Router($accessControl, $throttle, $formatsConfig, "HelloWorld"); |
10 | 10 | |
11 | 11 | try { |
12 | - $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']); |
|
12 | + $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']); |
|
13 | 13 | |
14 | - try { |
|
15 | - echo $router->handle($request); |
|
16 | - } catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){ |
|
17 | - header('400 Bad Request', true, 400); |
|
18 | - } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
19 | - header('404 Not Found', true, 404); |
|
20 | - } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
21 | - header('404 Not Found', true, 404); |
|
22 | - } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
23 | - header('403 Access Denied', true, 403); |
|
24 | - } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
25 | - header('429 Too Many Requests', true, 429); |
|
26 | - } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
27 | - header('500 Internal Server Error', true, 500); |
|
28 | - } catch(Exception $e){ |
|
29 | - header('500 Internal Server Error', true, 500); |
|
30 | - } |
|
14 | + try { |
|
15 | + echo $router->handle($request); |
|
16 | + } catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){ |
|
17 | + header('400 Bad Request', true, 400); |
|
18 | + } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
19 | + header('404 Not Found', true, 404); |
|
20 | + } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
21 | + header('404 Not Found', true, 404); |
|
22 | + } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
23 | + header('403 Access Denied', true, 403); |
|
24 | + } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
25 | + header('429 Too Many Requests', true, 429); |
|
26 | + } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
27 | + header('500 Internal Server Error', true, 500); |
|
28 | + } catch(Exception $e){ |
|
29 | + header('500 Internal Server Error', true, 500); |
|
30 | + } |
|
31 | 31 | } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
32 | - header('400 Bad Request', true, 400); |
|
32 | + header('400 Bad Request', true, 400); |
|
33 | 33 | } catch(Exception $e){ |
34 | - header('500 Internal Server Error', true, 500); |
|
34 | + header('500 Internal Server Error', true, 500); |
|
35 | 35 | } |
@@ -10,29 +10,29 @@ |
||
10 | 10 | $router = new \LunixREST\Router\Router($accessControl, $throttle, $formatsConfig, "GeoPhone"); |
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 | - try { |
|
16 | - echo $router->handle($request); |
|
17 | - } catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){ |
|
18 | - header('400 Bad Request', true, 400); |
|
19 | - } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
20 | - header('404 Not Found', true, 404); |
|
21 | - } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
22 | - header('404 Not Found', true, 404); |
|
23 | - } catch(\LunixREST\Exceptions\InstanceNotFoundException $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(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
30 | - header('500 Internal Server Error', true, 500); |
|
31 | - } catch(Exception $e){ |
|
32 | - header('500 Internal Server Error', true, 500); |
|
33 | - } |
|
15 | + try { |
|
16 | + echo $router->handle($request); |
|
17 | + } catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){ |
|
18 | + header('400 Bad Request', true, 400); |
|
19 | + } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
20 | + header('404 Not Found', true, 404); |
|
21 | + } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
22 | + header('404 Not Found', true, 404); |
|
23 | + } catch(\LunixREST\Exceptions\InstanceNotFoundException $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(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
30 | + header('500 Internal Server Error', true, 500); |
|
31 | + } catch(Exception $e){ |
|
32 | + header('500 Internal Server Error', true, 500); |
|
33 | + } |
|
34 | 34 | } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
35 | - header('400 Bad Request', 400); |
|
35 | + header('400 Bad Request', 400); |
|
36 | 36 | } catch(Exception $e){ |
37 | - header('500 Internal Server Error', true, 500); |
|
37 | + header('500 Internal Server Error', true, 500); |
|
38 | 38 | } |