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.
- checksums.yaml +4 -4
- data/lib/json_requester.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '041898e00afdd4c92015862bf81b7e09c61ba47a878eb9f2d90b77669862c722'
|
4
|
+
data.tar.gz: 1ee45b7f13909acfe21330fb8c311bb79f82bf9213c93974db199dba6f5eb86e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ef9fec55ef8e7acb71540acc7505290d40f638350339a6cce963a8945e9d516d77be11243908a2a12d440afd6534e1ce4141d83b0d3ad6edb5e0967faf526ee
|
7
|
+
data.tar.gz: e2e6296099857c012b2e402f952f49a02b8ebbcf24d5ff0c3bc2c380fcee797e6c144ed55eb1c685a82cd35857ccd1cbec6d8282699d024a8dece57f93bfe1d2
|
data/lib/json_requester.rb
CHANGED
@@ -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
|
-
|
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.
|
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:
|
11
|
+
date: 2024-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|