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

Version Path
nicksieger-multipart-post-0.9 lib/multipartable.rb
puppet-module-0.3.4 vendor/multipart-post-1.0/lib/multipartable.rb
multipart-post-1.1.2 lib/multipartable.rb
multipart-post-1.1.1 lib/multipartable.rb
subdb-0.1.4 vendor/multipart-post/multipartable.rb
subdb-0.1.3 vendor/multipart-post/multipartable.rb
subdb-0.1.2 vendor/multipart-post/multipartable.rb
puppet-module-0.3.3 vendor/multipart-post-1.0/lib/multipartable.rb
multipart-post-1.1.0 lib/multipartable.rb
puppet-module-0.3.2 vendor/multipart-post-1.0/lib/multipartable.rb
jwagener-multipart-post-1.0.3 lib/multipartable.rb
puppet-module-0.3.0 vendor/multipart-post-1.0/lib/multipartable.rb
multipart-post-1.0.1 lib/multipartable.rb
multipart-post-1.0 lib/multipartable.rb