authograph 1.0.0 → 1.0.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: 2fa21ab9df699ee62947bfb58d37e05d55ae3eef
4
- data.tar.gz: 64eacefff4e51281f71126ff9d89faa2ce0ad4c8
3
+ metadata.gz: 5a009a88fac93d49a6386eb963bd7e540ab904c3
4
+ data.tar.gz: 299582d4a1eb05ababa92219e1a6c4883a327d88
5
5
  SHA512:
6
- metadata.gz: 498b424873a5b7d2aaefc8f0d4c2990bde82e0219cbccb6cffc039b8549b9370bc696c805e7b6825669b605d25a69fe6ed4319064d0c593b33fbd47ee63730ba
7
- data.tar.gz: 7c08538b13cbe9ab33ef66f9df03721b195825950126868252e49be754d6dd214182c7d7253fae3fb7cdccfd7787d925969522c662ea029cf2ff4d2b3a8bb3c5
6
+ metadata.gz: a61ca58c96985b2357ba5af9a3ea503869c51836edfe9bb3bd84c818c9974cd8e5ba1b8f3b14e39086193d566fc033a03f35ed4ed62461efb827d069d8eb5c7c
7
+ data.tar.gz: 1c032e7dad769f70a81fc0186f6b6de6d122c7b8be9829bf16a72e10d013301beb5bd304ab4a25ea030e47ad8dd272c278c4a6dc9cd6625c02c9a79d1a27c436
@@ -25,10 +25,15 @@ module Authograph::Adapters
25
25
  end
26
26
 
27
27
  def body
28
- return '' unless @request.body_stream
29
- data = @request.body_stream.read
30
- @request.body_stream.rewind
31
- data
28
+ if !@request.body_stream.nil?
29
+ data = @request.body_stream.read
30
+ @request.body_stream.rewind
31
+ data
32
+ elsif !@request.body.nil?
33
+ @request.body
34
+ else
35
+ ''
36
+ end
32
37
  end
33
38
  end
34
39
  end
@@ -87,22 +87,21 @@ module Authograph
87
87
  def build_payload(_request)
88
88
  parts = [
89
89
  _request.method,
90
- _request.path,
91
- _request.content_type || '',
92
- body_md5(_request)
90
+ _request.path
93
91
  ]
94
92
 
93
+ if %w[POST PUT].include?(_request.method)
94
+ parts << _request.content_type || ''
95
+ parts << body_md5(_request)
96
+ end
97
+
95
98
  # extra headers to be considered
96
99
  @sign_headers.each { |h| parts << (_request.get_header(h) || '') }
97
100
  parts.join "\n"
98
101
  end
99
102
 
100
103
  def body_md5(_request)
101
- if %w[POST PUT].include?(_request.method)
102
- Digest::MD5.base64digest _request.body
103
- else
104
- ''
105
- end
104
+ Digest::MD5.base64digest _request.body
106
105
  end
107
106
  end
108
107
  end
@@ -1,3 +1,3 @@
1
1
  module Authograph
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authograph
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas