100.times do |i|
thread = Thread.new do
params = {}
params["id"] = "1"
params["music_path"] = "这儿是音乐文件"
params["friend_id"] = "2"
params["type"] = "1"
params["time_seq"] = "这儿是文本文件"
params["emotion_id"] = "2"
params["message"] = "Let's dance!'"
params["image_name"] = "happy"
params["operation_time"] = "20140108"
uri = URI.parse("http://192.168.0.105:8080/dance/submit_dance")
res = Net::HTTP.post_form(uri, params)
puts res.body
end
#thread.join
end
代码如上,模拟多个用户发送请求,要传的参数是文件,怎么办呀?