json_requester 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/json_requester.rb +6 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc7d06fc0826a6e7c0de5aa79a3f0f3bfa8825939594a46bd0f94d00fff2b4e2
4
- data.tar.gz: 251126b9edcdd2c645f7510f388d6ab5f80b4954695c309c99bb402758a6ec10
3
+ metadata.gz: '041898e00afdd4c92015862bf81b7e09c61ba47a878eb9f2d90b77669862c722'
4
+ data.tar.gz: 1ee45b7f13909acfe21330fb8c311bb79f82bf9213c93974db199dba6f5eb86e
5
5
  SHA512:
6
- metadata.gz: d2eddf1750ef801739e6dae0108a085954b3e0d41276f171a365ba5df5bb99f84ce666467fdcb2c5824c9a6c6be9a35976e219a3e2c95cd848e00e5bae5cd92b
7
- data.tar.gz: 7d2d352b07533fd5906ddf8ea08687d8e320cd1dad193f46abe576bc0b4b304981956e8f87ef84fe32794d958554531dd2cbfffbbd9b676e4cebf84b7f121384
6
+ metadata.gz: 9ef9fec55ef8e7acb71540acc7505290d40f638350339a6cce963a8945e9d516d77be11243908a2a12d440afd6534e1ce4141d83b0d3ad6edb5e0967faf526ee
7
+ data.tar.gz: e2e6296099857c012b2e402f952f49a02b8ebbcf24d5ff0c3bc2c380fcee797e6c144ed55eb1c685a82cd35857ccd1cbec6d8282699d024a8dece57f93bfe1d2
@@ -33,12 +33,16 @@ class JsonRequester
33
33
  error_response(e)
34
34
  end
35
35
 
36
- def json_send(http_method, path, params={}, headers={}, sort_params: true, need_response_header: false)
36
+ def json_send(http_method, path, params={}, headers={}, sort_params: true, need_response_header: false, content_type_charset: 'utf-8')
37
37
  conn = init_conn(sort_params: sort_params)
38
38
  res = conn.send(http_method) do |req|
39
39
  req.url path
40
40
  req.headers = headers if object_present?(headers)
41
- req.headers['Content-Type'] = 'application/json;charset=utf-8'
41
+ if content_type_charset.present?
42
+ req.headers['Content-Type'] = "application/json;charset=#{content_type_charset}"
43
+ else
44
+ req.headers['Content-Type'] = 'application/json'
45
+ end
42
46
  req.body = params.to_json if object_present?(params)
43
47
  end
44
48
  process_response(res, need_response_header: need_response_header)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_requester
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - JiaRou Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-13 00:00:00.000000000 Z
11
+ date: 2024-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday