[英]sending form via AJAX as post - which is better content-type multipart/form-data or application/json
Environment - server is node.js with express and appropriate modules.环境 - 服务器是 node.js,带有快速和适当的模块。
I know how to send data using both methods (as multipart/form-data and also application/json).我知道如何使用这两种方法(如 multipart/form-data 和 application/json)发送数据。
For simple form submissions with no file uploads or such, I find it a bit cumbersome to send data using multipart/form-data and would prefer to keep using application/json for my POST requests.对于没有文件上传等的简单表单提交,我发现使用 multipart/form-data 发送数据有点麻烦,并且更愿意继续使用 application/json 来处理我的 POST 请求。
Is there any reason why I should choose to send forms as multipart/form-data over application/json if there is no file upload involved?如果不涉及文件上传,有什么理由我应该选择将 forms 作为 multipart/form-data 通过 application/json 发送?
ie if it is more secure or has some data security benefit?即它是否更安全或有一些数据安全优势?
application/json is better for this case. application/json 更适合这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.