rack-jsonp-tools 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rack/jsonp/callback.rb +2 -2
- data/lib/rack/jsonp/status_wrapper.rb +1 -1
- data/rack-jsonp-tools.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/rack/jsonp/callback.rb
CHANGED
@@ -16,8 +16,8 @@ module Rack
|
|
16
16
|
# Call original app
|
17
17
|
status, headers, @body = @app.call(env)
|
18
18
|
if headers["Content-Type"].to_s.start_with?("application/json")
|
19
|
-
@pre, @post = "#{callback}(", ")"
|
20
|
-
headers["Content-Length"] = (@pre.size + headers["Content-Length"].to_i + @post.size).to_s
|
19
|
+
@pre, @post = "#{callback}(", ")"
|
20
|
+
headers["Content-Length"] = (@pre.size + headers["Content-Length"].to_i + @post.size).to_s if headers["Content-Length"]
|
21
21
|
headers["Content-Type"] = "application/javascript" # Set proper content type as per RFC4329
|
22
22
|
[200, headers, self]
|
23
23
|
else
|
@@ -13,7 +13,7 @@ module Rack
|
|
13
13
|
|
14
14
|
if headers["Content-Type"].to_s.start_with?("application/json")
|
15
15
|
@pre, @post = '{"body":', ', "status":' + status.to_s + '}'
|
16
|
-
headers["Content-Length"] = (@pre.size + headers["Content-Length"].to_i + @post.size).to_s
|
16
|
+
headers["Content-Length"] = (@pre.size + headers["Content-Length"].to_i + @post.size).to_s if headers["Content-Length"]
|
17
17
|
[status, headers, self]
|
18
18
|
else
|
19
19
|
[status, headers, @body]
|
data/rack-jsonp-tools.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rack-jsonp-tools}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jacek Becela"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-05}
|
13
13
|
s.description = %q{A collection of rack middlewares helping you add JSONP to your app}
|
14
14
|
s.email = %q{jacek.becela@gmail.com}
|
15
15
|
s.files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 1
|
9
|
+
version: 0.4.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jacek Becela
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-05 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|