lib/rollbar/middleware/js.rb in rollbar-2.25.1 vs lib/rollbar/middleware/js.rb in rollbar-2.26.0

- old
+ new

@@ -78,11 +78,14 @@ def build_response(env, app_result, response_string) return app_result unless response_string env[JS_IS_INJECTED_KEY] = true - response = ::Rack::Response.new(response_string, app_result[0], - app_result[1]) + + status, headers, = app_result + headers['Content-Length'] = response_string.bytesize.to_s if headers.key?('Content-Length') + + response = ::Rack::Response.new(response_string, status, headers) finished = response.finish # Rack < 2.x Response#finish returns self in array[2]. Rack >= 2.x returns self.body. # Always return with the response object here regardless of rack version.