lib/sqreen/dependency/sinatra.rb in sqreen-1.18.6-java vs lib/sqreen/dependency/sinatra.rb in sqreen-1.19.0.beta1

- old
+ new

@@ -1,8 +1,11 @@ +# typed: ignore + # Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.com/terms.html +require 'sqreen/shrink_wrap' require 'sqreen/middleware' require 'sqreen/error_handling_middleware' require 'sqreen/sinatra_middleware' module Sqreen @@ -31,14 +34,22 @@ else u.insert(0, p) end end - insert_middleware(builder, Sqreen::Middleware, args, block) do |p, u| + insert_middleware(builder, Sqreen::ShrinkWrap, args, block) do |p, u| if (i = middlewares(builder).index(::Sinatra::ExtendedRack)) u.insert(i, p) else u.insert(0, p) + end + end + + insert_middleware(builder, Sqreen::Middleware, args, block) do |p, u| + if (i = middlewares(builder).index(::Sinatra::ExtendedRack)) + u.insert(i, p) + else + u.insert(1, p) end end insert_middleware(builder, Sqreen::SinatraMiddleware, args, block) do |p, u| if ::Sqreen::Dependency.const_exist?('Rack::PostBodyContentTypeParser') && (i = middlewares(builder).index(::Rack::PostBodyContentTypeParser))