我对节点js的multipart / formdata请求不满意。
我正在抓取一个执行multipart / formdata请求的网站。这是这样的:
url : https://example.com
Content-Type: multipart/form-data;boundary=----
formdata :
Content-Disposition: form-data; name=field1
value1
Content-Disposition: form-data; name=field1
value1
Content-Disposition: form-data; name=field2
value2
Content-Disposition: form-data; name=field3
value3
Content-Disposition: form-data; name=field4
value4
Content-Disposition: form-data; name=^\^"theFile^\^"; filename=^\^"^\^"^
Content-Type: application/octet-stream^
我正在使用节点js的请求模块来执行此操作。就是这样
var options = {
method: 'POST',
url: "https://example.com",
formData : {
"field1" : "value1",
"field2" : "value2",
"field3" : "value3",
"field4" : "value4",
"theFile": {
"value": "",
"options": {
"filename": '',
"contentType": 'application/octet-stream'
}
}
}
}
我在哪里做错了?