Sha256: 517668ad14291d6ee06461efe062075b0d94aa36892597d151428f439ac721b0

Contents?: true

Size: 512 Bytes

Versions: 12

Compression:

Stored size: 512 Bytes

Contents

module Faraday
  class Request::ActiveSupportJson < Faraday::Middleware
    begin
      if !defined?(ActiveSupport::JSON)
        require 'active_support'
        ActiveSupport::JSON
      end

    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] = ActiveSupport::JSON.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/active_support_json.rb
faraday-0.4.5 lib/faraday/request/active_support_json.rb
faraday-0.4.4 lib/faraday/request/active_support_json.rb
faraday-0.4.3 lib/faraday/request/active_support_json.rb
faraday-0.4.2 lib/faraday/request/active_support_json.rb
faraday-0.4.1 lib/faraday/request/active_support_json.rb
faraday-0.4.0 lib/faraday/request/active_support_json.rb
faraday-0.3.1 lib/faraday/request/active_support_json.rb
faraday-0.3.0 lib/faraday/request/active_support_json.rb
faraday-0.2.4 lib/faraday/request/active_support_json.rb
faraday-0.2.3 lib/faraday/request/active_support_json.rb
faraday-0.2.2 lib/faraday/request/active_support_json.rb