module Http::MultipartMethods::MultipartBase
Constants
- DEFAULT_BOUNDARY
Public Instance Methods
body=(value)
click to toggle source
# File lib/angus/remote/http/multipart_methods/multipart_base.rb, line 14 def body=(value) @body_parts = value.map {|(k,v)| Parts::Part.new(boundary, k, v)} @body_parts << Parts::EpiloguePart.new(boundary) set_headers_for_body end
boundary()
click to toggle source
# File lib/angus/remote/http/multipart_methods/multipart_base.rb, line 20 def boundary DEFAULT_BOUNDARY end
initialize_http_header(initheader)
click to toggle source
prevent reinitialization of headers
Calls superclass method
# File lib/angus/remote/http/multipart_methods/multipart_base.rb, line 9 def initialize_http_header(initheader) super set_headers_for_body end
Private Instance Methods
set_headers_for_body()
click to toggle source
# File lib/angus/remote/http/multipart_methods/multipart_base.rb, line 26 def set_headers_for_body if @body_parts self.set_content_type('multipart/form-data', {'boundary' => boundary}) self.content_length = @body_parts.inject(0) { |sum,i| sum + i.length } self.body_stream = CompositeReadIO.new(*@body_parts.map { |part| part.to_io }) end end