Skip to content

Commit

Permalink
Fix a crash on webrick with Rack 2.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gsamokovarov committed Jul 12, 2020
1 parent b18a195 commit fb48374
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/web_console/injector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def inject(content)
# Set Content-Length header to the size of the current body
# + the extra content. Otherwise the response will be truncated.
if @headers["Content-Length"]
@headers["Content-Length"] = @body.bytesize + content.bytesize
@headers["Content-Length"] = (@body.bytesize + content.bytesize).to_s
end

[
Expand Down
2 changes: 1 addition & 1 deletion test/web_console/injector_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class InjectorTest < ActiveSupport::TestCase
body = [ "foo" ]
headers = { "Content-Length" => 3 }

assert_equal [ [ "foobar" ], { "Content-Length" => 6 } ], Injector.new(body, headers).inject("bar")
assert_equal [ [ "foobar" ], { "Content-Length" => "6" } ], Injector.new(body, headers).inject("bar")
end
end
end

0 comments on commit fb48374

Please sign in to comment.