faraday_middleware 0.12.2 → 0.13.0

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
- SHA1:
3
- metadata.gz: 67f099d83d2c464e52923be602b2fd0679e25540
4
- data.tar.gz: cd5251554042cc0446e5d7a6261880c6a08d1f04
2
+ SHA256:
3
+ metadata.gz: b3276b16e454e801286b52a8ba62f765b7517d63c2e224b336371e8a53facc41
4
+ data.tar.gz: 1d7c8d737d91c247bc4bd3ae1326d5e1ce1096126eb7ed8c7bde8bf0b47f4260
5
5
  SHA512:
6
- metadata.gz: fe301bc8e38984c256bc6a757d3830e76b19bc7835ea469f4cde040ac8167abf84b5ab1fcfc9c195e0bfbe15b557d9788f002ea422801fec3672a158907fffa8
7
- data.tar.gz: 00aebfd22482f2d38aa55dbd85ea8097d2d676c01747301a39492ea47415a2a8b4fb8b61a70d0a117fc3cd6d569974457ed4bf4f189da2be77c4ac3e6b0aa2bd
6
+ metadata.gz: 2d1b3441e3e62a474f6cc91d6b3b4d44214773b4036049b7b4f12bcdc827f0b8b8b7d5b0b0ed37fb8dda99271c8228eb4ffaeb82ee51ceb05a0e27c783d43a1e
7
+ data.tar.gz: '08da04c8e67e334409a7df32374afb45576cf5bf960e007fcca684c384674e54eabcbd32a3849a3b57b6a6ff04604fa352baabb5beb619417830a1719c9b128b'
data/README.md CHANGED
@@ -10,13 +10,14 @@ Dependencies
10
10
 
11
11
  Some dependent libraries are needed only when using specific middleware:
12
12
 
13
- * FaradayMiddleware::EncodeJson & FaradayMiddleware::ParseJson: "json"
14
- for ruby older than 1.9
15
- * FaradayMiddleware::ParseXml: "multi_xml"
16
- * FaradayMiddleware::OAuth: "simple_oauth"
17
- * FaradayMiddleware::Mashify: "hashie"
18
- * FaradayMiddleware::Rashify: "rash_alt" (Make sure to uninstall original rash gem to avoid conflict)
19
- * FaradayMiddleware::Instrumentation: "activesupport"
13
+ | Middleware | Library | Notes |
14
+ | --------------------------- | -------------- | ----- |
15
+ | [FaradayMiddleware::Instrumentation](https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/instrumentation.rb) | [`activesupport`](https://rubygems.org/gems/activesupport) | |
16
+ | [FaradayMiddleware::OAuth](https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/request/oauth.rb) | [`simple_oauth`](https://rubygems.org/gems/simple_oauth) | |
17
+ | [FaradayMiddleware::ParseXml](https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/response/parse_xml.rb) | [`multi_xml`](https://rubygems.org/gems/multi_xml) | |
18
+ | [FaradayMiddleware::ParseYaml](https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/response/parse_yaml.rb) | [`safe_yaml`](https://rubygems.org/gems/safe_yaml) | Not backwards compatible with versions of this middleware prior to `faraday_middleware` v0.12. See code comments for alternatives. |
19
+ | [FaradayMiddleware::Mashify](https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/response/mashify.rb) | [`hashie`](https://rubygems.org/gems/hashie) | |
20
+ | [FaradayMiddleware::Rashify](https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/response/rashify.rb) | [`rash_alt`](https://rubygems.org/gems/rash_alt) | Make sure to uninstall original `rash` gem to avoid conflict. |
20
21
 
21
22
  Examples
22
23
  --------
@@ -1,15 +1,18 @@
1
1
  # deprecated constants
2
2
 
3
- Faraday::Request.class_eval do
4
- autoload :OAuth, 'faraday_middleware/request/oauth'
5
- autoload :OAuth2, 'faraday_middleware/request/oauth2'
6
- end
3
+ module Faraday
4
+ class Request
5
+ autoload :OAuth, 'faraday_middleware/request/oauth'
6
+ autoload :OAuth2, 'faraday_middleware/request/oauth2'
7
+ end
7
8
 
8
- Faraday::Response.class_eval do
9
- autoload :Mashify, 'faraday_middleware/response/mashify'
10
- autoload :Rashify, 'faraday_middleware/response/rashify'
11
- autoload :ParseJson, 'faraday_middleware/response/parse_json'
12
- autoload :ParseXml, 'faraday_middleware/response/parse_xml'
13
- autoload :ParseMarshal, 'faraday_middleware/response/parse_marshal'
14
- autoload :ParseYaml, 'faraday_middleware/response/parse_yaml'
9
+ class Response
10
+ autoload :Mashify, 'faraday_middleware/response/mashify'
11
+ autoload :Rashify, 'faraday_middleware/response/rashify'
12
+ autoload :ParseJson, 'faraday_middleware/response/parse_json'
13
+ autoload :ParseXml, 'faraday_middleware/response/parse_xml'
14
+ autoload :ParseMarshal, 'faraday_middleware/response/parse_marshal'
15
+ autoload :ParseYaml, 'faraday_middleware/response/parse_yaml'
16
+ end
15
17
  end
18
+
@@ -16,7 +16,7 @@ module FaradayMiddleware
16
16
  ACCEPT_ENCODING = 'Accept-Encoding'.freeze
17
17
  CONTENT_ENCODING = 'Content-Encoding'.freeze
18
18
  CONTENT_LENGTH = 'Content-Length'.freeze
19
- SUPPORTED_ENCODINGS = 'gzip,deflate'.freeze
19
+ SUPPORTED_ENCODINGS = 'gzip,deflate,br'.freeze
20
20
  RUBY_ENCODING = '1.9'.respond_to?(:force_encoding)
21
21
 
22
22
  def call(env)
@@ -27,6 +27,8 @@ module FaradayMiddleware
27
27
  reset_body(response_env, &method(:uncompress_gzip))
28
28
  when 'deflate'
29
29
  reset_body(response_env, &method(:inflate))
30
+ when 'br'
31
+ reset_body(response_env, &method(:brotli_inflate))
30
32
  end
31
33
  end
32
34
  end
@@ -60,5 +62,11 @@ module FaradayMiddleware
60
62
  inflate.close
61
63
  end
62
64
  end
65
+
66
+ def brotli_inflate(body)
67
+ self.class.dependency 'brotli'
68
+
69
+ Brotli.inflate(body)
70
+ end
63
71
  end
64
72
  end
@@ -1,7 +1,6 @@
1
1
  require 'faraday'
2
2
  require 'forwardable'
3
- # fixes normalizing query strings:
4
- require 'faraday_middleware/addressable_patch' if defined? ::Addressable::URI
3
+ require 'digest/sha1'
5
4
 
6
5
  module FaradayMiddleware
7
6
  # Public: Caches GET responses and pulls subsequent ones from the cache.
@@ -22,7 +21,7 @@ module FaradayMiddleware
22
21
 
23
22
  # Public: initialize the middleware.
24
23
  #
25
- # cache - An object that responds to read, write and fetch (default: nil).
24
+ # cache - An object that responds to read and write (default: nil).
26
25
  # options - An options Hash (default: {}):
27
26
  # :ignore_params - String name or Array names of query params
28
27
  # that should be ignored when forming the cache
@@ -66,7 +65,8 @@ module FaradayMiddleware
66
65
  url.query = params.any? ? build_query(params) : nil
67
66
  end
68
67
  url.normalize!
69
- url.request_uri
68
+
69
+ Digest::SHA1.hexdigest(url.request_uri)
70
70
  end
71
71
 
72
72
  def params_to_ignore
@@ -1,3 +1,3 @@
1
1
  module FaradayMiddleware
2
- VERSION = '0.12.2' unless defined?(FaradayMiddleware::VERSION)
2
+ VERSION = '0.13.0' 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.2
4
+ version: 0.13.0
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-08-03 00:00:00.000000000 Z
12
+ date: 2019-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -42,7 +42,6 @@ files:
42
42
  - LICENSE.md
43
43
  - README.md
44
44
  - lib/faraday_middleware.rb
45
- - lib/faraday_middleware/addressable_patch.rb
46
45
  - lib/faraday_middleware/backwards_compatibility.rb
47
46
  - lib/faraday_middleware/gzip.rb
48
47
  - lib/faraday_middleware/instrumentation.rb
@@ -82,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
81
  - !ruby/object:Gem::Version
83
82
  version: '0'
84
83
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.6.11
84
+ rubygems_version: 3.0.2
87
85
  signing_key:
88
86
  specification_version: 4
89
87
  summary: Various middleware for Faraday
@@ -1,20 +0,0 @@
1
- require 'addressable/uri'
2
-
3
- # feature-detect the bug
4
- unless Addressable::URI.parse('/?a=1&b=2') === '/?b=2&a=1'
5
- # fix `normalized_query` by sorting query key-value pairs
6
- # (rejected: https://github.com/sporkmonger/addressable/issues/28)
7
- class Addressable::URI
8
- alias normalized_query_without_ordering_fix normalized_query
9
-
10
- def normalized_query
11
- fresh = @normalized_query.nil?
12
- query = normalized_query_without_ordering_fix
13
- if query && fresh
14
- @normalized_query = query.split('&', -1).sort_by {|q| q[0..(q.index('=')||-1)] }.join('&')
15
- else
16
- query
17
- end
18
- end
19
- end
20
- end