Sha256: e65ca442995f16376a82f558e722fe8052d89d62eae60c57bbaf7f0d736f485c
Contents?: true
Size: 613 Bytes
Versions: 2
Compression:
Stored size: 613 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(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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
multipart-post-1.1.4 | lib/multipartable.rb |
multipart-post-1.1.3 | lib/multipartable.rb |