From 4a146018f9dbc6d5f47b53a8f7c7aef73e76b236 Mon Sep 17 00:00:00 2001 From: Jeff Van Boxtel Date: Tue, 9 Jun 2015 11:48:39 -0700 Subject: [PATCH 1/2] Don't override the user's debug configuration in case they want to see the trace route for errors while in debug enironments. --- jsonAPI/JsonApiMiddleware.php | 1 - 1 file changed, 1 deletion(-) diff --git a/jsonAPI/JsonApiMiddleware.php b/jsonAPI/JsonApiMiddleware.php index 71e947f..b773e4c 100644 --- a/jsonAPI/JsonApiMiddleware.php +++ b/jsonAPI/JsonApiMiddleware.php @@ -30,7 +30,6 @@ class JsonApiMiddleware extends \Slim\Middleware { function __construct(){ $app = \Slim\Slim::getInstance(); - $app->config('debug', false); // Mirrors the API request $app->get('/return', function() use ($app) { From 2794a95c9881f8fa52cc05fcb62d11597daef332 Mon Sep 17 00:00:00 2001 From: Jeff Van Boxtel Date: Thu, 13 Aug 2015 15:46:04 -0700 Subject: [PATCH 2/2] We really don't want to send a 500 error for anything except json with an empty body. --- jsonAPI/JsonApiMiddleware.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jsonAPI/JsonApiMiddleware.php b/jsonAPI/JsonApiMiddleware.php index b773e4c..f605fa5 100644 --- a/jsonAPI/JsonApiMiddleware.php +++ b/jsonAPI/JsonApiMiddleware.php @@ -62,9 +62,10 @@ function __construct(){ // Handle Empty response body $app->hook('slim.after.router', function () use ($app) { - //Fix sugested by: https://github.com/bdpsoft - //Will allow download request to flow - if($app->response()->header('Content-Type')==='application/octet-stream'){ + + // don't render an empty response warning + // if we have specified another content-type + if($app->response()->header('Content-Type')!=='application/json'){ return; }