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.



57
58
59
60
# File 'lib/simplewoo/connection.rb', line 57

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

Instance Method Details

#call(env) ⇒ Object



62
63
64
65
# File 'lib/simplewoo/connection.rb', line 62

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