faraday_middleware-aws-signers-v4 0.1.2 → 0.1.3

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: 4ba70dd3bae68eb5ac7bdd6a1541d1eeb3c1cdc7
4
- data.tar.gz: 83f657d1a18bfb39cb77f796864959b9bc35730f
3
+ metadata.gz: 4b03901381f827e2c229ace22d97a1f875d4f9e6
4
+ data.tar.gz: 1ae6a545ace1c81005359eaeff6b19fb74437b25
5
5
  SHA512:
6
- metadata.gz: 860e21850b3d39d7c57a76840ceac8a6a83a2d2d97b89e55ad285bf17105eef6174772db30e99f077cdc87950a0d5c2afb2f63a4e7deca09ad2f0b158207a852
7
- data.tar.gz: abb14ce16ba163b15d54353373fe17fa79bc2ee584b58eb5ae1875ab721b0a2c5a7a66fa73223feba63fa58312ed1d83ced22e7769aa8b372472addf0e52f19f
6
+ metadata.gz: b6c9418fd4a22dcf156344de1f0aecd86e69f166358a2f8e3a1f17850337f8b90bc39752517fe9d47f8b36f6c733309486d77afe18b72f71d4f05f268d861208
7
+ data.tar.gz: 1d6a77f6b3aeeee0003d700a0b8e5cdb647ed14a8dddb6d41510ad0c21d6356db45ea786e6677c4d424129cdbb908d8e172ec00e83e528506dd32d23abc7a3fb
data/README.md CHANGED
@@ -37,7 +37,7 @@ conn = Faraday.new(url: 'https://apigateway.us-east-1.amazonaws.com') do |farada
37
37
  service_name: 'apigateway',
38
38
  region: 'us-east-1'
39
39
 
40
- faraday.response :json, :content_type => /\bjson$/
40
+ faraday.response :json, :content_type => /\bjson\b/
41
41
  faraday.response :raise_error
42
42
 
43
43
  faraday.adapter Faraday.default_adapter
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = 'faraday_middleware-aws-signers-v4'
4
- spec.version = '0.1.2'
4
+ spec.version = '0.1.3'
5
5
  spec.authors = ['Genki Sugawara']
6
6
  spec.email = ['sgwr_dts@yahoo.co.jp']
7
7
 
@@ -15,12 +15,29 @@ class FaradayMiddleware::AwsSignersV4 < Faraday::Middleware
15
15
  end
16
16
 
17
17
  def endpoint
18
- @env.url
18
+ url = @env.url.dup
19
+
20
+ # Escape the query string or the request won't sign correctly
21
+ if url and url.query
22
+ re_escape_query!(url)
23
+ end
24
+
25
+ url
19
26
  end
20
27
 
21
28
  def http_method
22
29
  @env.method.to_s.upcase
23
30
  end
31
+
32
+ private
33
+
34
+ def re_escape_query!(url)
35
+ unescaped = CGI.unescape(url.query)
36
+
37
+ if unescaped =~ / /
38
+ url.query = Seahorse::Util.uri_escape(unescaped)
39
+ end
40
+ end
24
41
  end
25
42
 
26
43
  def initialize(app, options = nil)
@@ -35,12 +52,6 @@ class FaradayMiddleware::AwsSignersV4 < Faraday::Middleware
35
52
 
36
53
  def call(env)
37
54
  normalize_for_net_http!(env)
38
-
39
- # Escape the query string or the request won't sign correctly
40
- if env.url and env.url.query
41
- env.url.query = Seahorse::Util.uri_escape(env.url.query)
42
- end
43
-
44
55
  req = Request.new(env)
45
56
  @signer.sign(req)
46
57
  @app.call(env)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_middleware-aws-signers-v4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara