rack-jsonp-tools 0.3.4 → 0.3.5

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.4
1
+ 0.3.5
@@ -12,7 +12,7 @@ module Rack
12
12
  status, headers, @body = @app.call(env)
13
13
 
14
14
  if headers["Content-Type"] == "application/json"
15
- @pre, @post = '{"body": ', ', "status": ' + status.to_s + '}'
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]
18
18
  else
@@ -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.4"
8
+ s.version = "0.3.5"
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"]
@@ -37,18 +37,15 @@ class CallbackTest < Test::Unit::TestCase
37
37
  assert_equal expected_body, body
38
38
  end
39
39
 
40
- test "doesn't touch response if outside of status range 200...300" do
40
+ test "doesn't touch response if content type is not application/json" do
41
41
  env = Rack::MockRequest.env_for("/?_callback=callback")
42
- app = Rack::JSONP::Callback.new(lambda { |env| [301, @headers, [@body]] })
42
+ app = Rack::JSONP::Callback.new(lambda { |env| [301, {}, [""]] })
43
43
 
44
44
  status, headers, iterable = app.call(env)
45
45
  body = ""; iterable.each { |l| body << l }
46
46
 
47
47
  assert_equal 301, status
48
- assert_equal @headers, {
49
- "Content-Type" => "application/json",
50
- "Content-Length" => @body.size.to_s
51
- }
52
- assert_equal @body, body
48
+ assert_equal Hash.new, headers
49
+ assert_equal "", body
53
50
  end
54
51
  end
@@ -33,7 +33,7 @@ class StatusWrapperTest < Test::Unit::TestCase
33
33
  status, headers, iterable = app.call(env)
34
34
  body = ""; iterable.each { |l| body << l }
35
35
 
36
- expected_body = 'callback({"body": ' + @body + ', "status": ' + @status.to_s + '})'
36
+ expected_body = 'callback({"body":' + @body + ', "status":' + @status.to_s + '})'
37
37
 
38
38
  assert_equal 200, status
39
39
  assert_equal @headers, {
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 4
9
- version: 0.3.4
8
+ - 5
9
+ version: 0.3.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jacek Becela