Skip to content

Commit

Permalink
Ruby-1.9 fix: re-encode body in ASCII-8BIT.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdub committed Sep 1, 2010
1 parent 82db4c7 commit 21557a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/sham_rack/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ def method_env(request)
def io_env(request, body)
raise(ArgumentError, "both request.body and body argument were provided") if (request.body && body)
body ||= request.body || ""
body = body.to_s
body = body.encode("ASCII-8BIT") if body.respond_to?(:encode)
{
"rack.input" => StringIO.new(body.to_s),
"rack.input" => StringIO.new(body),
"rack.errors" => $stderr
}
end
Expand Down

0 comments on commit 21557a7

Please sign in to comment.