xi_wechat_corp 1.0.3 → 1.0.4

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: 90c43037a4be97c8c48a1d7dfe357b3a197bee85
4
- data.tar.gz: 3c72a0baba173aa4671087b8b0d6275974e54e98
3
+ metadata.gz: c109c81bff8d13daf9242207b0239b4cc09d7d32
4
+ data.tar.gz: 7616d63d571138f5992d03ca0171bdc6010424c9
5
5
  SHA512:
6
- metadata.gz: 98faffc7e5ca9bbf4804b5cae14a3cd20b1b88b9a2c68b55a2eeb747c32baa934a8d02a97c02991162c483398331f58b273c88ab2960031a1cbe60b07a0c222e
7
- data.tar.gz: ccef2f240b9f869d001cf1859c73d8a5bd8c4f0a9af57601e9c2fb9feaecc460148aca9984bf9aefc28388dc31e82f5489e0bd8884487c0cdc2f8496d33eda4c
6
+ metadata.gz: e20ca22e76380506c320226b3046764651e71f682528cd1d0671dc5f84242b76dcff5af0ea9899ebee76ece1a76868a4e7ddd69a6db068554b42e2c57e4fdcc3
7
+ data.tar.gz: e70eae4d05307646c2250414a0b109518140a2c5d9bf5b74503bdfe48e02201595f864e106fb36af49b1328f1542723f656cac3b75856ccb83f4410931bb50ee
@@ -25,7 +25,7 @@ module XiWechatCorp
25
25
  [
26
26
  SecureRandom.random_bytes(16),
27
27
  [text.bytesize].pack('N'),
28
- text,
28
+ text.force_encoding('ASCII-8BIT'),
29
29
  @corp_id
30
30
  ].join('')
31
31
  end
@@ -35,7 +35,7 @@ module XiWechatCorp
35
35
  output = corp_id.slice!(0, size)
36
36
 
37
37
  raise InvalidCorpIDError.new(corp_id) if corp_id != @corp_id
38
- output
38
+ output.force_encoding('UTF-8')
39
39
  end
40
40
 
41
41
  def pad(text)
@@ -37,7 +37,7 @@ module XiWechatCorp
37
37
  cryptor = AesCrypt.new(credentials.aes_key, credentials.corp_id)
38
38
  signer = SHA1Signer.new(credentials.token)
39
39
  query_params = parse_query(rack_request.query_string)
40
- Request.new(cryptor, signer, query_params, rack_request.body)
40
+ Request.new(cryptor, signer, query_params, rack_request.body.read)
41
41
  end
42
42
  end
43
43
  end
@@ -9,7 +9,7 @@ module XiWechatCorp
9
9
  module Callback
10
10
  class Rack
11
11
  include ::Rack::Utils
12
- CONTENT_TYPE = 'text/html; charset=utf-8'
12
+ CONTENT_TYPE = 'application/xml; charset=utf-8'
13
13
 
14
14
  def initialize(app, &block)
15
15
  @app = app
@@ -19,7 +19,8 @@ module XiWechatCorp
19
19
  end
20
20
 
21
21
  def assign(query_params, xml = nil)
22
- body_params = xml ? parse_xml(xml) : {}
22
+ xml = xml.to_s
23
+ body_params = xml.size > 0 ? parse_xml(xml) : {}
23
24
  @params = body_params.merge(query_params)
24
25
  end
25
26
 
@@ -1,3 +1,3 @@
1
1
  module XiWechatCorp
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xi_wechat_corp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Yang