aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/test_process.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-05-19 16:01:42 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-05-19 16:24:26 -0700
commitb43309328a4a4c1f6fda6db40a4a86a3c8d643fc (patch)
treebb5ace11b3167d0b34155ede7d8523aac5d35f57 /actionpack/lib/action_controller/test_process.rb
parentb5c8433a6f7f869bfcd2001f8c3c4660716e873b (diff)
downloadrails-b43309328a4a4c1f6fda6db40a4a86a3c8d643fc.tar.gz
rails-b43309328a4a4c1f6fda6db40a4a86a3c8d643fc.tar.bz2
rails-b43309328a4a4c1f6fda6db40a4a86a3c8d643fc.zip
Ruby 1.9 compat: ensure binary encoding for post body parsing
Diffstat (limited to 'actionpack/lib/action_controller/test_process.rb')
-rw-r--r--actionpack/lib/action_controller/test_process.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index dcb6cdf4ca..f03ed5b2a7 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -49,7 +49,7 @@ module ActionController #:nodoc:
# Either the RAW_POST_DATA environment variable or the URL-encoded request
# parameters.
def raw_post
- env['RAW_POST_DATA'] ||= url_encoded_request_parameters
+ env['RAW_POST_DATA'] ||= returning(url_encoded_request_parameters) { |b| b.force_encoding(Encoding::BINARY) if b.respond_to?(:force_encoding) }
end
def port=(number)
@@ -340,6 +340,7 @@ module ActionController #:nodoc:
@content_type = content_type
@original_filename = path.sub(/^.*#{File::SEPARATOR}([^#{File::SEPARATOR}]+)$/) { $1 }
@tempfile = Tempfile.new(@original_filename)
+ @tempfile.set_encoding(Encoding::BINARY) if @tempfile.respond_to?(:set_encoding)
@tempfile.binmode if binary
FileUtils.copy_file(path, @tempfile.path)
end