summaryrefslogtreecommitdiff
path: root/lib/rack/mock.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rack/mock.rb')
-rw-r--r--lib/rack/mock.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/rack/mock.rb b/lib/rack/mock.rb
index ae50fd41..8d1e0635 100644
--- a/lib/rack/mock.rb
+++ b/lib/rack/mock.rb
@@ -128,8 +128,7 @@ module Rack
end
end
- empty_str = ""
- empty_str.force_encoding("ASCII-8BIT") if empty_str.respond_to? :force_encoding
+ empty_str = ''.force_encoding(Encoding::ASCII_8BIT)
opts[:input] ||= empty_str
if String === opts[:input]
rack_input = StringIO.new(opts[:input])
@@ -137,7 +136,7 @@ module Rack
rack_input = opts[:input]
end
- rack_input.set_encoding(Encoding::BINARY) if rack_input.respond_to?(:set_encoding)
+ rack_input.set_encoding(Encoding::BINARY)
env['rack.input'] = rack_input
env["CONTENT_LENGTH"] ||= env["rack.input"].length.to_s