class HTTParty::Request::Body

def generate_multipart

def generate_multipart
  normalized_params = params.flat_map { |key, value| HashConversions.normalize_keys(key, value) }
  multipart = normalized_params.inject(''.dup) do |memo, (key, value)|
    memo << "--#{boundary}#{NEWLINE}"
    memo << %(Content-Disposition: form-data; name="#{key}")
    # value.path is used to support ActionDispatch::Http::UploadedFile
    # https://github.com/jnunemaker/httparty/pull/585
    memo << %(; filename="#{file_name(value).gsub(/["\r\n]/, MULTIPART_FORM_DATA_REPLACEMENT_TABLE)}") if file?(value)
    memo << NEWLINE
    memo << "Content-Type: #{content_type(value)}#{NEWLINE}" if file?(value)
    memo << NEWLINE
    memo << content_body(value)
    memo << NEWLINE
  end
  multipart << "--#{boundary}--#{NEWLINE}"
end