json_requester 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/json_requester.rb +2 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '041898e00afdd4c92015862bf81b7e09c61ba47a878eb9f2d90b77669862c722'
4
- data.tar.gz: 1ee45b7f13909acfe21330fb8c311bb79f82bf9213c93974db199dba6f5eb86e
3
+ metadata.gz: 6a0dd5080d2bec29884d6da9cf56099973847d3ba0841f296089591278ce6b84
4
+ data.tar.gz: ac92413b55e07c14f48515ce0e62cfb5e990b701c8eb5ee2b3c7887cd9cdf124
5
5
  SHA512:
6
- metadata.gz: 9ef9fec55ef8e7acb71540acc7505290d40f638350339a6cce963a8945e9d516d77be11243908a2a12d440afd6534e1ce4141d83b0d3ad6edb5e0967faf526ee
7
- data.tar.gz: e2e6296099857c012b2e402f952f49a02b8ebbcf24d5ff0c3bc2c380fcee797e6c144ed55eb1c685a82cd35857ccd1cbec6d8282699d024a8dece57f93bfe1d2
6
+ metadata.gz: 8103bb5bf91b6df2ddfb88558d4c8091beaf3893ce0a24d17a4a91f8dfcc99b0e7aecd73c0b65beac5c5e7e2d21ac6de4b5fe71fe9e6dc2ac3532a31ad66289e
7
+ data.tar.gz: e137988468f479c1e7a26d9a1aaacfe4e2d9935286b884fa42f6edd462e5dc283e94a2e980b9329cccc82c4e94f9ffbe5bbe2a5d140464b95a2b49f0ab57b2eb
data/README.md CHANGED
@@ -30,7 +30,8 @@ $ gem install json_requester
30
30
  # Request by using JSON body or query params, use the `http_send` method.
31
31
  # other methods: `form_send`, `multipart_form_send`
32
32
  # `sort_params` at Faraday gem default is true.
33
- res = requester.http_send(http_method, path, params, headers, sort_params: true)
33
+ # `content_type_charset` default is 'utf-8', this will add ; charset=utf-8 after `Content-Type` header (ex. `Content-Type=application/json; charset=utf-8`).
34
+ res = requester.http_send(http_method, path, params, headers, sort_params: true, content_type_charset: 'utf-8')
34
35
 
35
36
  # http response code
36
37
  puts res['status'] # 200, 404, .. etc
@@ -12,12 +12,12 @@ class JsonRequester
12
12
  @user_agent = user_agent.strip.to_s
13
13
  end
14
14
 
15
- def http_send(http_method, path, params={}, headers={}, sort_params: true, need_response_header: false)
15
+ def http_send(http_method, path, params={}, headers={}, sort_params: true, need_response_header: false, content_type_charset: 'utf-8')
16
16
  puts "send #{http_method} reqeust to #{@host} with\npath: #{path}\nparams: #{params}\nheaders: #{headers}"
17
17
  if http_method == :get
18
18
  normal_send(http_method, path, params, headers, sort_params: sort_params, need_response_header: need_response_header)
19
19
  else
20
- json_send(http_method, path, params, headers, sort_params: sort_params, need_response_header: need_response_header)
20
+ json_send(http_method, path, params, headers, sort_params: sort_params, need_response_header: need_response_header, content_type_charset: content_type_charset)
21
21
  end
22
22
  end
23
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_requester
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - JiaRou Lee