class Rack::TruncateErrorBody
Constants
- VERSION
Public Class Methods
new(app, options = {})
click to toggle source
# File lib/rack/truncate_error_body.rb, line 5 def initialize(app, options = {}) @app = app @options = options end
Public Instance Methods
call(env)
click to toggle source
# File lib/rack/truncate_error_body.rb, line 10 def call(env) res = @app.call(env) type = @options[:content_type] || "text/plain" if (!@options[:only_cascaded] || res[1]["X-Cascade"] == "pass") && res[0] >= 400 [res[0], {"Content-Type" => type}, []] else res end end