lib/gris/application.rb in gris-0.5.2 vs lib/gris/application.rb in gris-0.5.3

- old
+ new

@@ -2,14 +2,17 @@ module Gris class Application include ActiveSupport::Configurable config_accessor :use_health_middleware + config_accessor :use_error_handlers_middleware def self.instance(config = {}) @instance ||= Rack::Builder.new do use Gris::Middleware::Health unless config[:use_health_middleware] == false + use Gris::Middleware::ErrorHandlers unless config[:use_error_handlers_middleware] == false + use Rack::Cors do allow do origins '*' resource '*', headers: :any, methods: :get end @@ -17,16 +20,9 @@ run Gris::Application.new end.to_app end def call(env) - response = ApplicationEndpoint.call(env) - case response[0] - when 404, 500 - body = { code: response[0], message: response[2] }.to_json - [response[0], response[1], [body]] - else - response - end + ApplicationEndpoint.call(env) end end end