Sha256: e6f3cc8de271a8c9e96d13e9cae116194bba4bf005a78aa302dc3467d411c5f6

Contents?: true

Size: 312 Bytes

Versions: 5

Compression:

Stored size: 312 Bytes

Contents

require 'faraday'

module Faraday
  class Response::ParseJson < Response::Middleware
    dependency 'multi_json'

    def parse(body)
      case body
      when ''
        nil
      when 'true'
        true
      when 'false'
        false
      else
        ::MultiJson.decode(body)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
faraday_middleware-0.7.0 lib/faraday/response/parse_json.rb
faraday_middleware-0.7.0.rc1 lib/faraday/response/parse_json.rb
faraday_middleware-0.6.5 lib/faraday/response/parse_json.rb
faraday_middleware-0.6.3 lib/faraday/response/parse_json.rb
faraday_middleware-0.6.0 lib/faraday/response/parse_json.rb