handle($request); if ($response->hasHeader('Content-Disposition')) { return $response; } else { return $response->withHeader('Content-Type', 'application/json'); } } }