Sha256: 367b86f442bb0927c81cf0431cd72e7379cd79f2221044d10717032dd08ac642

Contents?: true

Size: 407 Bytes

Versions: 1

Compression:

Stored size: 407 Bytes

Contents

# frozen_string_literal: true

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

    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

1 entries across 1 versions & 1 rubygems

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