Class: Simplewoo::Connection::TrustedAppMiddleware

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/simplewoo/connection.rb

Overview

Middleware for inserting the trusted header into requests

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ TrustedAppMiddleware

Returns a new instance of TrustedAppMiddleware.



44
45
46
47
# File 'lib/simplewoo/connection.rb', line 44

def initialize(app, options = {})
  @app = app
  @options = options
end

Instance Method Details

#call(env) ⇒ Object



49
50
51
52
# File 'lib/simplewoo/connection.rb', line 49

def call(env)
  env[:request_headers]["Woofound-Use-Trusted"] = @options[:trusted].to_s
  @app.call(env)
end