rack-jsonr 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/rack/jsonr/jsonr.rb +6 -5
- data/lib/rack/jsonr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzFjZjg3ZjY1MjkxODRmZjdlMDhmMzRjMDg5OGIzZTM0ZWI4ODI1YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDkzZGNmOWJlMWExMmUwNzRmMWUyZjMxYjRhMDc1NjIyNzg3NTc4Nw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDBjZWFhZGQxMmI1OTk2ODVkOWQ4Y2MwMmJhZWYxODRmNTQxZWI0MWQzM2My
|
10
|
+
YTM4Njc0ZDFhZjQwNDk3OGJlNDE4NDViZDZmNzA1MDQ0YTgyMmQ5MDkwMjU5
|
11
|
+
ODU4Yjk3YzgwMTE1NWMwZWRlMjY4ZjM3NjlkMDQ4ZTNkYzU1N2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTAyMGQxYmNhY2I0MTM5MDlmNWQzNTIwZjRlMDU2NDEyNzAxYmRjNmNkMjRh
|
14
|
+
ZDMyZmQ4MTUzYTY5MWYyN2E1MGRiMGVlNWFiODczN2U0ZWQ1NzE3Y2JlOWJh
|
15
|
+
MDQ5MGQ2YjRiMDk3YTNlNTk5MTE3NjM0YzAyODEwZTM5ZGYzYjg=
|
data/lib/rack/jsonr/jsonr.rb
CHANGED
@@ -27,13 +27,10 @@ module Rack
|
|
27
27
|
params = request.params
|
28
28
|
|
29
29
|
if is_jsonp_request?(request)
|
30
|
-
env['IS_REQUESTING_JSONP'] = true
|
31
30
|
env['REQUEST_METHOD'] = params['request_method'].upcase if params['request_method'] and ['POST','PUT','DELETE'].include?(params['request_method'].upcase)
|
32
|
-
else
|
33
|
-
env['IS_REQUESTING_JSONP'] = false
|
34
31
|
end
|
35
32
|
|
36
|
-
if is_jsonp_request?(request) and is_json_response?(headers)
|
33
|
+
if is_jsonp_request?(request) #and is_json_response?(headers)
|
37
34
|
response = format_jsonp(request.params.delete('callback'), status, headers, response)
|
38
35
|
status = 200
|
39
36
|
|
@@ -56,7 +53,11 @@ module Rack
|
|
56
53
|
end
|
57
54
|
|
58
55
|
def is_jsonp_request?(request)
|
59
|
-
@is_jsonp_request ||=
|
56
|
+
@is_jsonp_request ||= self.class.is_jsonp_request?(request)
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.is_jsonp_request?(request)
|
60
|
+
(request.params.include?('callback') and request.get?)
|
60
61
|
end
|
61
62
|
|
62
63
|
# Formats the JSONP padding to include body, headers and http status
|
data/lib/rack/jsonr/version.rb
CHANGED