Class: OMCMS::SetHeader

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/omcms/middleware/set_header.rb

Constant Summary collapse

HEADERS =
{
  "user-agent": "omcms/ruby/client/#{VERSION}"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ SetHeader

Returns a new instance of SetHeader.



9
10
11
12
# File 'lib/omcms/middleware/set_header.rb', line 9

def initialize(app)
  super(app)
  @app = app
end

Instance Method Details

#on_request(request_env) ⇒ Object



14
15
16
# File 'lib/omcms/middleware/set_header.rb', line 14

def on_request(request_env)
  request_env[:request_headers].merge! HEADERS
end