Flowdock
method

send_request_with_body_data

Importance_0
v1_9_3_392 - Show latest stable - 0 notes - Class: Net::HTTPGenericRequest
send_request_with_body_data(sock, ver, path, params) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/net/http.rb, line 1960
    def send_request_with_body_data(sock, ver, path, params)
      if /\Amultipart\/form-data\z/ !~ self.content_type
        self.content_type = 'application/x-www-form-urlencoded'
        return send_request_with_body(sock, ver, path, URI.encode_www_form(params))
      end

      opt = @form_option.dup
      require 'securerandom' unless defined?(SecureRandom)
      opt[:boundary] ||= SecureRandom.urlsafe_base64(40)
      self.set_content_type(self.content_type, boundary: opt[:boundary])
      if chunked?
        write_header sock, ver, path
        encode_multipart_form_data(sock, params, opt)
      else
        require 'tempfile'
        file = Tempfile.new('multipart')
        file.binmode
        encode_multipart_form_data(file, params, opt)
        file.rewind
        self.content_length = file.size
        write_header sock, ver, path
        IO.copy_stream(file, sock)
      end
    end
Register or log in to add new notes.