Sha256: 426f12b9f6f26278a2898e0f00dffbfb9ec20717c6e9e67c8f78922bbdee7abb

Contents?: true

Size: 750 Bytes

Versions: 4

Compression:

Stored size: 750 Bytes

Contents

#--
# Copyright (c) 2007-2012 Nick Sieger.
# See the file README.txt included with the distribution for
# software license details.
#++

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(headers["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

4 entries across 4 versions & 3 rubygems

Version Path
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/multipart-post-1.2.0/lib/multipartable.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/multipart-post-1.2.0/lib/multipartable.rb
multipart-post-1.2.0 lib/multipartable.rb
multipart-post-1.1.5 lib/multipartable.rb