arkaan 1.3.5 → 1.3.6

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: d2abfbdbc0cad893f79ed3b3b42616ef1a8bdf01
4
- data.tar.gz: fc96c9ede1c2f95558f786391abaed4dc8868a2f
3
+ metadata.gz: 62b56ca6c7bcdfa712e85e1be0a8ea587f4a5c05
4
+ data.tar.gz: 24239984eba54cd23853df87d651798faf24986b
5
5
  SHA512:
6
- metadata.gz: '0438f9b21305372053ecf6e3cfa44348e9eb27084d34856c41011e046218f51f0e6ed715914443de6e421a8a21b07f5606bb5661bbbb8fbe2532aee03e0fd0ce'
7
- data.tar.gz: c47f0f473589c893fee3cd8ad4d1f9f4f10a9d62ad0ec61a4f52625a6c7d94985670b914b516fb1e399a1375a95495fc5badab5aab9ce5652abcae0c502f6f59
6
+ metadata.gz: 68e9ea60de0ded972deac3a94bb265a4f498a76bca42d1db353e17fbf1f9d9c1bd223c7e1955dc516b108e0e6207b1a2c780cd0fa6b7b1f0c7dd81f8e987927a
7
+ data.tar.gz: 69aee31a15cd98a2ae45e2da68ac8db7d8fce4a3c1e5935e97cf22a52842bb5f81d1267b01addaf6e5375fa1b4cadaff6ab1994693520b3048071a76e7b76de9
@@ -65,6 +65,7 @@ module Arkaan
65
65
 
66
66
  def before_checks
67
67
  add_body_to_params
68
+
68
69
  check_presence('token', 'app_key', route: 'common')
69
70
 
70
71
  gateway = Arkaan::Monitoring::Gateway.where(token: params['token']).first
@@ -119,9 +120,12 @@ module Arkaan
119
120
  # Adds the parsed body to the parameters, overwriting the parameters of the querystring with the values
120
121
  # of the SON body if they have similar keys.
121
122
  def add_body_to_params
122
- parsed_body = JSON.parse(request.body.read.to_s) rescue {}
123
- parsed_body.keys.each do |key|
124
- params[key] = parsed_body[key]
123
+ if request.body.respond_to?(:rewind) && request.body.respond_to?(:read)
124
+ request.body.rewind
125
+ parsed_body = JSON.parse(request.body.read.to_s) rescue {}
126
+ parsed_body.keys.each do |key|
127
+ params[key] = parsed_body[key]
128
+ end
125
129
  end
126
130
  end
127
131
 
@@ -136,7 +140,6 @@ module Arkaan
136
140
  # @param status [Integer] the HTTP status to halt the application with.
137
141
  # @param path [String] the path in the configuration file to access the URL.
138
142
  def custom_error(status, path)
139
-
140
143
  route, field, error = path.split('.')
141
144
  docs = settings.errors[route][field][error] rescue ''
142
145
  halt status, {status: status, field: field, error: error, docs: docs}.to_json
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkaan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-27 00:00:00.000000000 Z
11
+ date: 2018-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec