Sha256: 27e72edda7e263f8427457288c40067fe78001fe4393807309637d697ef40db6

Contents?: true

Size: 399 Bytes

Versions: 3

Compression:

Stored size: 399 Bytes

Contents

module LinkedIn
  module FaradayMiddleware
    class FormatRequest < Faraday::Middleware
      HEADER_NAME  = 'X-Li-Format'.freeze

      def initialize(app = nil, format = :json)
        super app
        @format = format
      end

      def call(env)
        env[:request_headers].reverse_merge! HEADER_NAME => @format.to_s unless @format.blank?
        @app.call env
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
linkedin2-0.0.19 lib/linkedin/faraday_middleware/format_request.rb
linkedin2-0.0.18 lib/linkedin/faraday_middleware/format_request.rb
linkedin2-0.0.17 lib/linkedin/faraday_middleware/format_request.rb