Sha256: 9383789b2e678c8b8df97888d558768ca88ed38f650a418956630cc49394a147

Contents?: true

Size: 554 Bytes

Versions: 8

Compression:

Stored size: 554 Bytes

Contents

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

      def self.register_on_complete(env)
        env[:response].on_complete do |finished_env|
          finished_env[:body] = parse(finished_env[:body])
        end
      end
    rescue LoadError, NameError => e
      self.load_error = e
    end

    def initialize(app)
      super
      @parser = nil
    end

    def self.parse(body)
      Yajl::Parser.parse(body)
    rescue Object => err
      raise Faraday::Error::ParsingError.new(err)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
faraday-0.5.6 lib/faraday/response/yajl.rb
faraday-0.5.6.pre lib/faraday/response/yajl.rb
faraday-0.5.5 lib/faraday/response/yajl.rb
faraday-0.5.4 lib/faraday/response/yajl.rb
faraday-0.5.3 lib/faraday/response/yajl.rb
faraday-0.5.2 lib/faraday/response/yajl.rb
faraday-0.5.1 lib/faraday/response/yajl.rb
faraday-0.5.0 lib/faraday/response/yajl.rb