rack-jsonp-tools 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
@@ -15,8 +15,7 @@ module Rack
15
15
 
16
16
  # Call original app
17
17
  status, headers, @body = @app.call(env)
18
-
19
- if headers["Content-Type"] == "application/json"
18
+ if headers["Content-Type"].to_s.start_with?("application/json")
20
19
  @pre, @post = "#{callback}(", ")"
21
20
  headers["Content-Length"] = (@pre.size + headers["Content-Length"].to_i + @post.size).to_s
22
21
  headers["Content-Type"] = "application/javascript" # Set proper content type as per RFC4329
@@ -6,12 +6,12 @@ module Rack
6
6
  @app = app
7
7
  end
8
8
 
9
- def call(env)
9
+ def call(env)
10
10
  if env["jsonp.callback"]
11
11
  # Call original app
12
12
  status, headers, @body = @app.call(env)
13
13
 
14
- if headers["Content-Type"] == "application/json"
14
+ if headers["Content-Type"].to_s.start_with?("application/json")
15
15
  @pre, @post = '{"body":', ', "status":' + status.to_s + '}'
16
16
  headers["Content-Length"] = (@pre.size + headers["Content-Length"].to_i + @post.size).to_s
17
17
  [status, headers, self]
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-jsonp-tools}
8
- s.version = "0.3.5"
8
+ s.version = "0.3.6"
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"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 5
9
- version: 0.3.5
8
+ - 6
9
+ version: 0.3.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jacek Becela