eukaliptus 0.7.1 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/eukaliptus/request.rb +33 -3
- data/lib/eukaliptus/version.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
data/lib/eukaliptus/request.rb
CHANGED
@@ -2,12 +2,42 @@ require 'rack/request'
|
|
2
2
|
|
3
3
|
# Extend Rack::Request to add some helpers for FB
|
4
4
|
class Request < ::Rack::Request
|
5
|
+
URL_ENCODED = %r{^application/x-www-form-urlencoded}
|
6
|
+
JSON_ENCODED = %r{^application/json}
|
7
|
+
|
5
8
|
def params
|
6
|
-
|
7
|
-
@params ||= Rack::Utils.parse_query(rack_input, "&")
|
9
|
+
@params ||= retrieve_params(env)
|
8
10
|
end
|
9
11
|
|
10
12
|
def facebook?
|
11
|
-
params[
|
13
|
+
params[:signed_request].present?
|
12
14
|
end
|
15
|
+
|
16
|
+
private
|
17
|
+
# Stolen from Goliath
|
18
|
+
def retrieve_params(env)
|
19
|
+
params = {}
|
20
|
+
params.merge!(::Rack::Utils.parse_nested_query(env['QUERY_STRING']))
|
21
|
+
|
22
|
+
if env['rack.input']
|
23
|
+
post_params = ::Rack::Utils::Multipart.parse_multipart(env)
|
24
|
+
unless post_params
|
25
|
+
body = env['rack.input'].read
|
26
|
+
env['rack.input'].rewind
|
27
|
+
|
28
|
+
post_params = case(env['CONTENT_TYPE'])
|
29
|
+
when URL_ENCODED then
|
30
|
+
::Rack::Utils.parse_nested_query(body)
|
31
|
+
when JSON_ENCODED then
|
32
|
+
MultiJson.decode(body)
|
33
|
+
else
|
34
|
+
{}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
params.merge!(post_params)
|
39
|
+
end
|
40
|
+
|
41
|
+
params
|
42
|
+
end
|
13
43
|
end
|
data/lib/eukaliptus/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: eukaliptus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.8.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- season
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-06-
|
14
|
+
date: 2011-06-12 00:00:00 +02:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|