Sha256: 27f0649370c784aacd856ef3f1c091ccbd34edbe9875a651616d2c881f638f86

Contents?: true

Size: 771 Bytes

Versions: 11

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true

if (defined?(Net) && defined?(Net::HTTP))

  if defined?(Rack::MINI_PROFILER_PREPEND_NET_HTTP_PATCH)
    module NetHTTPWithMiniProfiler
      def request(request, *args, &block)
        Rack::MiniProfiler.step("Net::HTTP #{request.method} #{request.path}") do
          super
        end
      end
    end
    Net::HTTP.prepend(NetHTTPWithMiniProfiler)
  else
    Net::HTTP.class_eval do
      def request_with_mini_profiler(*args, &block)
        request = args[0]
        Rack::MiniProfiler.step("Net::HTTP #{request.method} #{request.path}") do
          request_without_mini_profiler(*args, &block)
        end
      end
      alias request_without_mini_profiler request
      alias request request_with_mini_profiler
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rack-mini-profiler-3.0.0 lib/patches/net_patches.rb
rack-mini-profiler-2.3.4 lib/patches/net_patches.rb
rack-mini-profiler-2.3.3 lib/patches/net_patches.rb
rack-mini-profiler-2.3.2 lib/patches/net_patches.rb
rack-mini-profiler-2.3.1 lib/patches/net_patches.rb
rack-mini-profiler-2.3.0 lib/patches/net_patches.rb
rack-mini-profiler-2.2.1 lib/patches/net_patches.rb
rack-mini-profiler-2.2.0 lib/patches/net_patches.rb
rack-mini-profiler-2.1.0 lib/patches/net_patches.rb
rack-mini-profiler-2.0.4 lib/patches/net_patches.rb
rack-mini-profiler-2.0.3 lib/patches/net_patches.rb