def self.form_data_file(content, file_content_type)
thepart = "Content-Disposition: form-data; name=\"file\"; filename=\"*buffer*\"\r\n" +
"Content-Type: #{ file_content_type }\r\n\r\n#{ content }\r\n"
boundary = self.suggest_separator
while thepart.include? boundary
boundary = self.suggest_separator
end
body = "--" + boundary + "\r\n" + thepart + "--" + boundary + "--\r\n"
headers = {
"User-Agent" => "foreman-proxy/#{Proxy::VERSION}",
"Content-Type" => "multipart/form-data; boundary=#{ boundary }",
"Content-Length" => body.length.to_s
}
return headers, body
end