Sha256: 722c9146bc32dab2871d490690b9fb1e0eba1947b33c59b3594c5b052e70a1ae

Contents?: true

Size: 474 Bytes

Versions: 7

Compression:

Stored size: 474 Bytes

Contents

module MusicBrainz
  class Middleware < Faraday::Middleware
    def call(env)
      env[:request_headers].merge!(
        "User-Agent" => user_agent_string,
        "Via"        => via_string
      )
      @app.call(env)
    end

    def user_agent_string
      "#{config.app_name}/#{config.app_version} ( #{config.contact} )"
    end

    def via_string
      "gem musicbrainz/#{VERSION} (#{GH_PAGE_URL})"
    end

    def config
      MusicBrainz.config
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
musicbrainz-0.8.0 lib/musicbrainz/middleware.rb
musicbrainz-0.7.7 lib/musicbrainz/middleware.rb
musicbrainz-0.7.6 lib/musicbrainz/middleware.rb
musicbrainz-0.7.5 lib/musicbrainz/middleware.rb
musicbrainz-0.7.4 lib/musicbrainz/middleware.rb
musicbrainz-0.7.3 lib/musicbrainz/middleware.rb
musicbrainz-0.7.2 lib/musicbrainz/middleware.rb