Sha256: 8ac7b00cc70026ebd9f9f523a1abe1ee0762e60c45232777713b3d5560c5b626

Contents?: true

Size: 432 Bytes

Versions: 3

Compression:

Stored size: 432 Bytes

Contents

module Pupa
  class Processor
    module Middleware
      # A Faraday response middleware for parsing JSON.
      #
      # @see https://github.com/lostisland/faraday_middleware/issues/30#issuecomment-4706892
      class ParseJson < FaradayMiddleware::ResponseMiddleware
        dependency 'multi_json'

        define_parser do |body|
          MultiJson.load(body) unless body.strip.empty?
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pupa-0.0.11 lib/pupa/processor/middleware/parse_json.rb
pupa-0.0.10 lib/pupa/processor/middleware/parse_json.rb
pupa-0.0.9 lib/pupa/processor/middleware/parse_json.rb