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 +4 -4
- data/README.md +1 -1
- data/faraday_middleware-aws-signers-v4.gemspec +1 -1
- data/lib/faraday_middleware/request/aws_signers_v4.rb +18 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b03901381f827e2c229ace22d97a1f875d4f9e6
|
4
|
+
data.tar.gz: 1ae6a545ace1c81005359eaeff6b19fb74437b25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -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)
|