Sha256: 34845f25a5d109303f1f629a6b7b614902d1c240748304d9071d8912ca7120bd
Contents?: true
Size: 558 Bytes
Versions: 14
Compression:
Stored size: 558 Bytes
Contents
require 'parts' module Multipartable DEFAULT_BOUNDARY = "-----------RubyMultipartPost" def initialize(path, params, headers={}, boundary = DEFAULT_BOUNDARY) super(path, headers) parts = params.map {|k,v| Parts::Part.new(boundary, k, v)} parts << Parts::EpiloguePart.new(boundary) ios = parts.map{|p| p.to_io } self.set_content_type("multipart/form-data", { "boundary" => boundary }) self.content_length = parts.inject(0) {|sum,i| sum + i.length } self.body_stream = CompositeReadIO.new(*ios) end end
Version data entries
14 entries across 14 versions & 5 rubygems