Sha256: 490076c7327380df6b705d6860eeccc9b1e53db1affc33673acb397f05924cfa

Contents?: true

Size: 369 Bytes

Versions: 2

Compression:

Stored size: 369 Bytes

Contents

module OMCMS
  class SetHeader < Faraday::Middleware
    HEADERS = {
      :"user-agent" => "omcms/ruby/client/#{VERSION}"
    }

    def initialize app
      super app
      @app = app
    end

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

Faraday::Request.register_middleware(omcms_set_header: OMCMS::SetHeader)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omcms-ruby-client-1.1.0 lib/omcms/middleware/set_header.rb
omcms-ruby-client-1.0.3 lib/omcms/middleware/set_header.rb