Class: FaradayMiddleware::ParseYaml

Inherits:
ResponseMiddleware show all
Defined in:
lib/faraday_middleware/response/parse_yaml.rb

Overview

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

Constant Summary

Constants inherited from ResponseMiddleware

ResponseMiddleware::CONTENT_TYPE

Method Summary

Methods inherited from ResponseMiddleware

#call, define_parser, inherited, #initialize, #parse, #parse_response?, #preserve_raw?, #process_response, #process_response_type?, #response_type

Constructor Details

This class inherits a constructor from FaradayMiddleware::ResponseMiddleware