nodejs发送formdata post请求
var FormData = require('form-data'); var request = require('request');
let form = new FormData(); form.append("taskID", job_id); form.append("Jobname", jobname); form.append("PRD_TYP", business_type); form.append("PRD_NUM", business_product); form.append("saler_img_path", saler_img_path); form.append("customer_img_path", customer_img_path); var request_url = 'http://' + server_host + ':' + server_port + '/createJob'
console.log("request_url ==> ", request_url) form.submit(request_url, function(err, res) { res.resume(); });
由于服务端接收的都是formdata数据,nodejs发送formdata post请求.