sinatra-jsonp 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/spec/jsonp_spec.rb +6 -6
- data/spec/spec_helper.rb +1 -1
- metadata +23 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c9dee9812369c37c433725cb4ef04f2eec38cbc
|
4
|
+
data.tar.gz: 0b7777e85e5a918779568fc2036c2267c095bdbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d040d054ebe338a021aa6d8b0a9028573e39e6ea3d826722698ac11db6f47c2364aa3421a8daf0e53f16be191f5415f79947eb6d726ea8434170dce4a322638
|
7
|
+
data.tar.gz: 48e8f0552e952e59c55d8fb8fb7a5cb34b7e437d8b226b9066e3d69682fc5cf8fbd7ad711cf936aab8df8ff42000ec9966bc17fe9e2d435d733cf071a1ac976d
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Sinatra::Jsonp [![Build Status](https://travis-ci.org/shtirlic/sinatra-jsonp.png)](https://travis-ci.org/shtirlic/sinatra-jsonp)
|
1
|
+
# Sinatra::Jsonp [![Build Status](https://travis-ci.org/shtirlic/sinatra-jsonp.png)](https://travis-ci.org/shtirlic/sinatra-jsonp) [![Gem Version](https://badge.fury.io/rb/sinatra-jsonp.svg)](https://badge.fury.io/rb/sinatra-jsonp)
|
2
2
|
|
3
3
|
JSONP output helper for [Sinatra](http://sinatrarb.com). Automatically detects callback params and returns proper JSONP output.
|
4
4
|
If callback params where not detected it returns plain JSON.
|
data/spec/jsonp_spec.rb
CHANGED
@@ -19,25 +19,25 @@ describe Sinatra::Jsonp do
|
|
19
19
|
|
20
20
|
it "returns JSON if no callback passed" do
|
21
21
|
get '/method'
|
22
|
-
body.
|
22
|
+
expect(body).to eq '["hello","hi","hallo"]'
|
23
23
|
end
|
24
24
|
it "returns JSONP if callback passed via request params" do
|
25
25
|
get '/method?callback=functionA'
|
26
|
-
body.
|
26
|
+
expect(body).to eq 'functionA(["hello","hi","hallo"])'
|
27
27
|
end
|
28
28
|
|
29
29
|
it "returns JSONP with sanitized callback" do
|
30
30
|
get '/method', { :callback=>'foo<script>alert(1)</script>' }
|
31
|
-
body.
|
31
|
+
expect(body).to eq 'fooscriptalert1script(["hello","hi","hallo"])'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "returns JSONP if callback passed via method param" do
|
35
35
|
get '/method_with_params'
|
36
|
-
body.
|
36
|
+
expect(body).to eq 'functionA(["hello","hi","hallo"])'
|
37
37
|
end
|
38
38
|
it "returns JSONP with callback passed via method params even if it passed via request param" do
|
39
39
|
get '/method_with_params?callback=functionB'
|
40
|
-
body.
|
40
|
+
expect(body).to eq 'functionA(["hello","hi","hallo"])'
|
41
41
|
end
|
42
42
|
|
43
43
|
it "return pretty JSON if :json_pretty enabled" do
|
@@ -50,6 +50,6 @@ describe Sinatra::Jsonp do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
get '/method'
|
53
|
-
body.
|
53
|
+
expect(body).to eq "[\n \"hello\",\n \"hi\",\n \"hallo\"\n]"
|
54
54
|
end
|
55
55
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-jsonp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serg Podtynnyi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,14 +70,14 @@ dependencies:
|
|
70
70
|
name: sinatra-contrib
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.0.9
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rack-test
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.7.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.7.0
|
97
111
|
description: JSONP output helper for Sinatra
|
98
112
|
email: serg.podtynnyi@gmail.com
|
99
113
|
executables: []
|
@@ -126,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
140
|
version: '0'
|
127
141
|
requirements: []
|
128
142
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.6.13
|
130
144
|
signing_key:
|
131
145
|
specification_version: 4
|
132
146
|
summary: JSONP output helper for Sinatra
|