facebook_canvas 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facebook_canvas/middleware.rb +5 -1
- data/lib/facebook_canvas/version.rb +1 -1
- data/test/dummy/log/test.log +0 -99
- data/test/integration/middleware_test.rb +5 -0
- 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: 671222c9de4e01aa0758554877228072dc53cda5
|
4
|
+
data.tar.gz: 66f6db07cb4b963e80257e87f31e64d94131ac17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eeeb7802f1939416017539812c8751bfb2b71dc68ca85792e48494fd5499770d9c2969d5c8a803886e0e831e12b41e88a682a50ea3b2fe53270e1c2903c2828
|
7
|
+
data.tar.gz: 19013a7bfcef261d5ac6c0f65b381c7f8e3b6ff513c2ff1ab2768e8f85fbd2e8ba9046488373c59fad201f6332705da21e68757084f8256f047bba141eb96b01
|
@@ -20,7 +20,7 @@ module FacebookCanvas
|
|
20
20
|
|
21
21
|
# Forces REQUEST_METHOD to GET if required.
|
22
22
|
def call(env)
|
23
|
-
if matches_server_name?(env) && was_get_request?(env) && custom_filter?(env)
|
23
|
+
if matches_server_name?(env) && was_get_request?(env) && !was_xhr_request?(env) && custom_filter?(env)
|
24
24
|
env["REQUEST_METHOD"] = "GET"
|
25
25
|
end
|
26
26
|
@app.call env
|
@@ -37,6 +37,10 @@ module FacebookCanvas
|
|
37
37
|
!form_hash["utf8"]
|
38
38
|
end
|
39
39
|
|
40
|
+
def was_xhr_request?(env)
|
41
|
+
env['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
|
42
|
+
end
|
43
|
+
|
40
44
|
def custom_filter?(env)
|
41
45
|
@custom_filter.call(env)
|
42
46
|
end
|
data/test/dummy/log/test.log
CHANGED
@@ -1,99 +0,0 @@
|
|
1
|
-
------------------------------
|
2
|
-
FacebookCanvasTest: test_truth
|
3
|
-
------------------------------
|
4
|
-
-----------------------------------------------------------------------
|
5
|
-
FacebookCanvas::SignedRequestTest: test_get_user_id_from_signed_request
|
6
|
-
-----------------------------------------------------------------------
|
7
|
-
--------------------------------------------------
|
8
|
-
FacebookCanvas::SignedRequestTest: test_initialize
|
9
|
-
--------------------------------------------------
|
10
|
-
---------------------------------------------------------------------------
|
11
|
-
FacebookCanvas::SignedRequestTest: test_no_access_token_from_signed_request
|
12
|
-
---------------------------------------------------------------------------
|
13
|
-
----------------------------------------------------------------------
|
14
|
-
FacebookCanvas::SignedRequestTest: test_no_user_id_from_signed_request
|
15
|
-
----------------------------------------------------------------------
|
16
|
-
----------------------------------------------------------------------------
|
17
|
-
FacebookCanvas::SignedRequestTest: test_get_access_token_from_signed_request
|
18
|
-
----------------------------------------------------------------------------
|
19
|
-
--------------------------------------------------------
|
20
|
-
FacebookCanvas::MiddlewareTest: test_do_not_convert_post
|
21
|
-
--------------------------------------------------------
|
22
|
-
Started POST "/foo/create" for 127.0.0.1 at 2015-12-03 14:47:24 +0100
|
23
|
-
Processing by FooController#create as HTML
|
24
|
-
Parameters: {"utf8"=>"utf"}
|
25
|
-
Rendered text template (0.0ms)
|
26
|
-
Completed 200 OK in 4ms (Views: 4.0ms)
|
27
|
-
----------------------------------------------------------------
|
28
|
-
FacebookCanvas::MiddlewareTest: test_convert_post_to_get_request
|
29
|
-
----------------------------------------------------------------
|
30
|
-
Started POST "/foo/index" for 127.0.0.1 at 2015-12-03 14:47:24 +0100
|
31
|
-
Processing by FooController#index as HTML
|
32
|
-
Rendered text template (0.0ms)
|
33
|
-
Completed 200 OK in 0ms (Views: 0.2ms)
|
34
|
-
---------------------------------------------------------------------------
|
35
|
-
FacebookCanvas::SignedRequestTest: test_no_access_token_from_signed_request
|
36
|
-
---------------------------------------------------------------------------
|
37
|
-
-----------------------------------------------------------------------
|
38
|
-
FacebookCanvas::SignedRequestTest: test_get_user_id_from_signed_request
|
39
|
-
-----------------------------------------------------------------------
|
40
|
-
--------------------------------------------------
|
41
|
-
FacebookCanvas::SignedRequestTest: test_initialize
|
42
|
-
--------------------------------------------------
|
43
|
-
----------------------------------------------------------------------
|
44
|
-
FacebookCanvas::SignedRequestTest: test_no_user_id_from_signed_request
|
45
|
-
----------------------------------------------------------------------
|
46
|
-
----------------------------------------------------------------------------
|
47
|
-
FacebookCanvas::SignedRequestTest: test_get_access_token_from_signed_request
|
48
|
-
----------------------------------------------------------------------------
|
49
|
-
--------------------------------------------------------
|
50
|
-
FacebookCanvas::MiddlewareTest: test_do_not_convert_post
|
51
|
-
--------------------------------------------------------
|
52
|
-
Started POST "/foo/create" for 127.0.0.1 at 2016-02-04 13:27:17 +0100
|
53
|
-
Processing by FooController#create as HTML
|
54
|
-
Parameters: {"utf8"=>"utf"}
|
55
|
-
Rendered text template (0.0ms)
|
56
|
-
Completed 200 OK in 7ms (Views: 6.4ms)
|
57
|
-
----------------------------------------------------------------
|
58
|
-
FacebookCanvas::MiddlewareTest: test_convert_post_to_get_request
|
59
|
-
----------------------------------------------------------------
|
60
|
-
Started POST "/foo/index" for 127.0.0.1 at 2016-02-04 13:27:17 +0100
|
61
|
-
Processing by FooController#index as HTML
|
62
|
-
Rendered text template (0.0ms)
|
63
|
-
Completed 200 OK in 0ms (Views: 0.2ms)
|
64
|
-
------------------------------
|
65
|
-
FacebookCanvasTest: test_truth
|
66
|
-
------------------------------
|
67
|
-
------------------------------
|
68
|
-
FacebookCanvasTest: test_truth
|
69
|
-
------------------------------
|
70
|
-
----------------------------------------------------------------
|
71
|
-
FacebookCanvas::MiddlewareTest: test_convert_post_to_get_request
|
72
|
-
----------------------------------------------------------------
|
73
|
-
Started POST "/foo/index" for 127.0.0.1 at 2016-02-16 15:19:16 +0100
|
74
|
-
Processing by FooController#index as HTML
|
75
|
-
Rendered text template (0.0ms)
|
76
|
-
Completed 200 OK in 5ms (Views: 4.7ms)
|
77
|
-
--------------------------------------------------------
|
78
|
-
FacebookCanvas::MiddlewareTest: test_do_not_convert_post
|
79
|
-
--------------------------------------------------------
|
80
|
-
Started POST "/foo/create" for 127.0.0.1 at 2016-02-16 15:19:16 +0100
|
81
|
-
Processing by FooController#create as HTML
|
82
|
-
Parameters: {"utf8"=>"utf"}
|
83
|
-
Rendered text template (0.0ms)
|
84
|
-
Completed 200 OK in 0ms (Views: 0.2ms)
|
85
|
-
----------------------------------------------------------------------------
|
86
|
-
FacebookCanvas::SignedRequestTest: test_get_access_token_from_signed_request
|
87
|
-
----------------------------------------------------------------------------
|
88
|
-
--------------------------------------------------
|
89
|
-
FacebookCanvas::SignedRequestTest: test_initialize
|
90
|
-
--------------------------------------------------
|
91
|
-
-----------------------------------------------------------------------
|
92
|
-
FacebookCanvas::SignedRequestTest: test_get_user_id_from_signed_request
|
93
|
-
-----------------------------------------------------------------------
|
94
|
-
----------------------------------------------------------------------
|
95
|
-
FacebookCanvas::SignedRequestTest: test_no_user_id_from_signed_request
|
96
|
-
----------------------------------------------------------------------
|
97
|
-
---------------------------------------------------------------------------
|
98
|
-
FacebookCanvas::SignedRequestTest: test_no_access_token_from_signed_request
|
99
|
-
---------------------------------------------------------------------------
|
@@ -10,4 +10,9 @@ class FacebookCanvas::MiddlewareTest < ActionDispatch::IntegrationTest
|
|
10
10
|
post '/foo/create', { "utf8" => "utf" }
|
11
11
|
assert_response :success
|
12
12
|
end
|
13
|
+
|
14
|
+
test 'do not convert xhr requests' do
|
15
|
+
xhr :post, '/foo/create'
|
16
|
+
assert_response :success
|
17
|
+
end
|
13
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebook_canvas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Stuhrmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|