node 【request】模块post的EncType问题
发布于 10 年前 作者 youngdeer 4515 次预览 最后一次回复是 10 年前 来自 问答
API中的解释: application/x-www-form-urlencoded (URL-Encoded Forms) URL-encoded forms are simple.
request.post('http://service.com/upload', {form:{key:'value'}})
// or
request.post('http://service.com/upload').form({key:'value'})
// or
request.post({url:'http://service.com/upload', form: {key:'value'}}, function(err,httpResponse,body){ /* ... */ })
使用上面的post是否和下面的效果一样
form#xxx(method="post" action="xxx")
input(type="hidden" name="xxx" value="xxx")
$("#xxx").submit();
1 回复
解决了,不小心把form:{key:‘value’}写成了formData:{key:‘value’} 这样EncType 就是multipart/form-data (Multipart Form Uploads)这种了