Sha256: f3c8f3049704ada8b21d6605f638bb798de6666492154899d24e0f3dad775e5c

Contents?: true

Size: 895 Bytes

Versions: 5

Compression:

Stored size: 895 Bytes

Contents

require 'faraday_middleware/response_middleware'

module FaradayMiddleware
  # Public: Parse response bodies as YAML.
  #
  # Warning: this uses `YAML.load()` by default and as such is not safe against
  # code injection or DoS attacks. If you're loading resources from an
  # untrusted host or over HTTP, you should subclass this middleware and
  # redefine it to use `safe_load()` if you're using a Psych version that
  # supports it:
  #
  #     class SafeYaml < FaradayMiddleware::ParseYaml
  #       define_parser do |body|
  #         YAML.safe_load(body)
  #       end
  #     end
  #
  #     Faraday.new(..) do |config|
  #       config.use SafeYaml
  #       ...
  #     end
  class ParseYaml < ResponseMiddleware
    dependency 'yaml'

    define_parser do |body|
      ::YAML.load body
    end
  end
end

# deprecated alias
Faraday::Response::ParseYaml = FaradayMiddleware::ParseYaml

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/faraday_middleware-0.11.0.1/lib/faraday_middleware/response/parse_yaml.rb
faraday_middleware-0.11.0.1 lib/faraday_middleware/response/parse_yaml.rb
faraday_middleware-0.10.1 lib/faraday_middleware/response/parse_yaml.rb
faraday_middleware-0.10.0 lib/faraday_middleware/response/parse_yaml.rb
faraday_middleware-0.9.2 lib/faraday_middleware/response/parse_yaml.rb