Sha256: d87acbc390522d1579284b8c7647c6aa3fe26bcf624b1dd81c025bc7e8973818

Contents?: true

Size: 393 Bytes

Versions: 5

Compression:

Stored size: 393 Bytes

Contents

require 'faraday'

module Faraday
  class Response::ParseError < Response::Middleware
    def on_complete(env)
      if 200 == env[:status] && 'unknown site' == env[:body]
        raise Faraday::Error::ParsingError, response_values(env)
      end
    end

    def response_values(env)
      {:status => env[:status], :headers => env[:response_headers], :body => env[:body]}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
direct_employers-0.0.6 lib/faraday/response/parse_error.rb
direct_employers-0.0.5 lib/faraday/response/parse_error.rb
direct_employers-0.0.4 lib/faraday/response/parse_error.rb
direct_employers-0.0.3 lib/faraday/response/parse_error.rb
direct_employers-0.0.2 lib/faraday/response/parse_error.rb