Sha256: 6bb068c99b3e32c4ca023b4f58ee4d5ab9fd520752d94c1f257eae8b4e2ce698

Contents?: true

Size: 403 Bytes

Versions: 12

Compression:

Stored size: 403 Bytes

Contents

module Faraday
  class Request::Yajl < Faraday::Middleware
    begin
      require 'yajl'

    rescue LoadError, NameError => e
      self.load_error = e
    end

    def call(env)
      env[:request_headers]['Content-Type'] = 'application/json'
      if env[:body] && !env[:body].respond_to?(:to_str)
        env[:body] = Yajl::Encoder.encode env[:body]
      end
      @app.call env
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
faraday-0.4.6 lib/faraday/request/yajl.rb
faraday-0.4.5 lib/faraday/request/yajl.rb
faraday-0.4.4 lib/faraday/request/yajl.rb
faraday-0.4.3 lib/faraday/request/yajl.rb
faraday-0.4.2 lib/faraday/request/yajl.rb
faraday-0.4.1 lib/faraday/request/yajl.rb
faraday-0.4.0 lib/faraday/request/yajl.rb
faraday-0.3.1 lib/faraday/request/yajl.rb
faraday-0.3.0 lib/faraday/request/yajl.rb
faraday-0.2.4 lib/faraday/request/yajl.rb
faraday-0.2.3 lib/faraday/request/yajl.rb
faraday-0.2.2 lib/faraday/request/yajl.rb