faraday_middleware 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c352d19f8d4edebdb7729a98d7c3b1fee0efff81
4
- data.tar.gz: 2d9cdcbd18177a69b876046438263c4d212919e7
3
+ metadata.gz: 98b62a188512ffc22a73d58652fdd1b812f0a481
4
+ data.tar.gz: 458cc66e01374dfc59e58b9231a061bfed6b8788
5
5
  SHA512:
6
- metadata.gz: 3f40ec0ae3ef9fdbd6f3b365c5cff9d936e11dfd720e9a3f363f8dddd93f22e60f4916ae4afba72ccdfc0e0eeb462db5910390cca48e9e7e86550f4165ef2f84
7
- data.tar.gz: e539f6866668031b76c7dfc9a8b6dca7f641ebdf86f518e2673b0bfe7f31facebaafa4c09aefa1109368a6416a2908b710845b9b519304b8ff1dfd80e8815434
6
+ metadata.gz: cb8e817ff09109ef7d47ddf01f7483b792e7696cf6cb39cacd378c0305f8b6b09776f38e411cb0fdb9201165412692bac5c3446f5dbb99b06af6f4208ad2edaa
7
+ data.tar.gz: 7c349cf036245554e4c94d125e64359c9269b518fc13c9b12b3dc887e5f037bf6e9d60f2bf7025c0554dedabe37eab80ce1da3c11ac92276ca311f562c9b38c5
@@ -8,7 +8,7 @@ module FaradayMiddleware
8
8
  end
9
9
 
10
10
  define_parser do |body, parser_options|
11
- ::JSON.parse(body, parser_options) unless body.strip.empty?
11
+ ::JSON.parse(body, parser_options || {}) unless body.strip.empty?
12
12
  end
13
13
 
14
14
  # Public: Override the content-type of the response with "application/json"
@@ -4,7 +4,7 @@ module FaradayMiddleware
4
4
  # Public: Restore marshalled Ruby objects in response bodies.
5
5
  class ParseMarshal < ResponseMiddleware
6
6
  define_parser do |body|
7
- ::Marshal.load body unless body.empty?
7
+ ::Marshal.load(body) unless body.empty?
8
8
  end
9
9
  end
10
10
  end
@@ -5,8 +5,8 @@ module FaradayMiddleware
5
5
  class ParseXml < ResponseMiddleware
6
6
  dependency 'multi_xml'
7
7
 
8
- define_parser do |body|
9
- ::MultiXml.parse(body)
8
+ define_parser do |body, parser_options|
9
+ ::MultiXml.parse(body, parser_options || {})
10
10
  end
11
11
  end
12
12
  end
@@ -26,8 +26,12 @@ module FaradayMiddleware
26
26
  class ParseYaml < ResponseMiddleware
27
27
  dependency 'safe_yaml/load'
28
28
 
29
- define_parser do |body|
30
- SafeYAML.load body
29
+ define_parser do |body, parser_options|
30
+ if SafeYAML::YAML_ENGINE == 'psych'
31
+ SafeYAML.load(body, nil, parser_options || {})
32
+ else
33
+ SafeYAML.load(body, parser_options || {})
34
+ end
31
35
  end
32
36
  end
33
37
  end
@@ -48,11 +48,7 @@ module FaradayMiddleware
48
48
  def parse(body)
49
49
  if self.class.parser
50
50
  begin
51
- if @parser_options
52
- self.class.parser.call(body, @parser_options)
53
- else
54
- self.class.parser.call(body)
55
- end
51
+ self.class.parser.call(body, @parser_options)
56
52
  rescue StandardError, SyntaxError => err
57
53
  raise err if err.is_a? SyntaxError and err.class.name != 'Psych::SyntaxError'
58
54
  raise Faraday::Error::ParsingError, err
@@ -1,3 +1,3 @@
1
1
  module FaradayMiddleware
2
- VERSION = "0.12.0" unless defined?(FaradayMiddleware::VERSION)
2
+ VERSION = '0.12.1' unless defined?(FaradayMiddleware::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_middleware
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Michaels-Ober
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-28 00:00:00.000000000 Z
12
+ date: 2017-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday