mirror of
https://github.com/jimeh/php-rack.git
synced 2026-02-19 11:56:38 +00:00
make api middleware output standardized JSON content
This commit is contained in:
@@ -8,7 +8,7 @@ class Api {
|
|||||||
|
|
||||||
function call (&$env) {
|
function call (&$env) {
|
||||||
if ( preg_match("/^\/api\/([a-z]{1}[a-z0-9]*)/i", $env["PATH_INFO"], $match) ) {
|
if ( preg_match("/^\/api\/([a-z]{1}[a-z0-9]*)/i", $env["PATH_INFO"], $match) ) {
|
||||||
return array(200, array("Content-Type" => "text/json"), array("{api_call: \"".$match[1]."\"}"));
|
return array(200, array("Content-Type" => "text/json"), array("{\"api_call\": \"".$match[1]."\"}"));
|
||||||
} else {
|
} else {
|
||||||
return $this->app->call($env);
|
return $this->app->call($env);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user