Class: Net::HTTP::Put
- Inherits:
-
Object
- Object
- Net::HTTP::Put
- Defined in:
- lib/nventory.rb
Overview
fix for ruby http bug where it encodes the params incorrectly
Instance Method Summary collapse
Instance Method Details
#set_form_data(params, sep = '&') ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/nventory.rb', line 28 def set_form_data(params, sep = '&') params_array = params.map do |k,v| if v.is_a? Array v.inject([]){|c, val| c << "#{urlencode(k.to_s)}=#{urlencode(val.to_s)}"}.join(sep) else "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" end end self.body = params_array.join(sep) self.content_type = 'application/x-www-form-urlencoded' end |