Method: Datadog::AppSec::Contrib::Faraday::Patcher.configure_default_faraday_connection
- Defined in:
- lib/datadog/appsec/contrib/faraday/patcher.rb
.configure_default_faraday_connection ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/datadog/appsec/contrib/faraday/patcher.rb', line 30 def configure_default_faraday_connection if target_version >= Gem::Version.new('1.0.0') # Patch the default connection (e.g. +Faraday.get+) ::Faraday.default_connection.use(:datadog_appsec) # Patch new connection instances (e.g. +Faraday.new+) ::Faraday::Connection.prepend(ConnectionPatch) else # Patch the default connection (e.g. +Faraday.get+) # # We insert our middleware before the 'adapter', which is # always the last handler. idx = ::Faraday.default_connection.builder.handlers.size - 1 ::Faraday.default_connection.builder.insert(idx, SSRFDetectionMiddleware) # Patch new connection instances (e.g. +Faraday.new+) ::Faraday::RackBuilder.prepend(RackBuilderPatch) end end |