Method: HTTP::Requestor#post_multipart

Defined in:
lib/http_requestor_multipart.rb

#post_multipart(path = "", data = {}, headers = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/http_requestor_multipart.rb', line 3

def post_multipart(path="", data={},headers=nil)
  @uri = URI.parse(@defaults[:domain] + path) unless path.empty?
  build_data(data)
  req = Net::HTTP::Post.new(@uri.request_uri)
  req.initialize_http_header(headers) unless headers.nil?
  req.body = @post_body
  req["Content-Type"] = "multipart/form-data; boundary=#{@boundary}"
  res = @http.request(req)
  @post_body = ""
  @boundary = ""
  res
end