Sha256: c2a26cfe7cfe0a75b18bb4d001a6852536113cd92b0722b824e9e8b2e072bc02

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

module Faraday
  class Branches < Faraday::Middleware

    def call(env)
      path = env[:url].path
      branch = Reviewed::Article.branch

      if path =~ /#{Reviewed::Article.resource_url}/ && branch
        query = env[:url].query || {}
        branch = Reviewed::Article.branch
        env[:url].query = Faraday::Utils.build_query(query.merge(branch: branch))
      end

      @app.call(env)
    end
  end
end

Faraday.register_middleware :request, branches: Faraday::Branches

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reviewed-0.0.9 lib/faraday/branches.rb