kea-on-rails 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kea/router.rb +13 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7105ad7fb8adb1a513589a9e1fca13b8d44e9f5a
|
4
|
+
data.tar.gz: 7f6e448ecdc375ca98fc3b781e9eacb47e41bbf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66829027fa6e3e77f6e7c4c3fc8e0ed1de70bd9c74cedb5c13d4b4a970aaed73564ca891ed0c497fb71f940f38976909e53e2929efb88370f6ddabb16f311b49
|
7
|
+
data.tar.gz: f56810a0980a3bf96227f796a33d3d1456560cb4f69a91a0c79ee6ebc2524548ac033206c0c33f25babefbc59925f2025d45670d2907c12b9d74d366e03f17dc
|
data/lib/kea/router.rb
CHANGED
@@ -11,35 +11,34 @@ module Kea
|
|
11
11
|
@env = env
|
12
12
|
|
13
13
|
request = Rack::Request.new(env)
|
14
|
+
|
14
15
|
body = request.body.read
|
16
|
+
request.body.rewind
|
17
|
+
|
18
|
+
if body.blank? && env['rack.request.form_vars'].present?
|
19
|
+
body = env['rack.request.form_vars']
|
20
|
+
end
|
15
21
|
|
16
22
|
params = nil
|
17
23
|
|
18
|
-
if body.present?
|
24
|
+
if body.present? && body =~ /\A{.*}\z/
|
19
25
|
params = JSON.parse(body).with_indifferent_access
|
20
|
-
|
26
|
+
elsif env['rack.request.form_hash'].present? && env['rack.request.form_hash']['endpoint'].present?
|
27
|
+
params = env['rack.request.form_hash'].with_indifferent_access
|
21
28
|
else
|
22
|
-
|
23
|
-
if env['rack.request.form_vars'].present?
|
24
|
-
json_params = JSON.parse(env['rack.request.form_vars']) rescue nil
|
25
|
-
params = json_params.with_indifferent_access if json_params.present?
|
26
|
-
|
27
|
-
if params.blank? && env['rack.request.form_hash'].present?
|
28
|
-
params = env['rack.request.form_hash'].with_indifferent_access
|
29
|
-
end
|
30
|
-
end
|
29
|
+
return render_error({ request: 'Request params not found' })
|
31
30
|
end
|
32
31
|
|
33
|
-
@env['kea.params'] = params
|
32
|
+
@env['kea.params'] = params
|
34
33
|
|
35
34
|
begin
|
36
35
|
@endpoint = params[:endpoint].classify.constantize
|
37
36
|
|
38
37
|
unless @endpoint.ancestors.include? Kea::Controller
|
39
|
-
return render_error({endpoint: 'does not descend from Kea::Controller'})
|
38
|
+
return render_error({ endpoint: 'does not descend from Kea::Controller' })
|
40
39
|
end
|
41
40
|
rescue => e
|
42
|
-
return render_error({exception: e.message})
|
41
|
+
return render_error({ exception: e.message })
|
43
42
|
end
|
44
43
|
|
45
44
|
@endpoint.action(:run_kea_action).call(env)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kea-on-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marius Andra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rails connector for kea and kea-rails-loader
|
14
14
|
email: marius.andra@gmail.com
|