【发布时间】:2014-08-21 06:04:03
【问题描述】:
我使用 PostMan 测试我的控制器,该控制器使用 req.param() 和 req.file() 从 POST 请求中读取数据。 奇怪的是,我提交的参数的顺序很重要。例如,
案例一:
file: some file attached
property1: 1
文件将被正确解析,而 property1 不会(未定义)。
案例 2:
file: some file attached
property1: 1
property2: 2
req.param('property2') 将为第一个请求返回 1(是的,1,此处没有错字),而为后续请求返回 undefined。
案例 3:
property1: 1
file: some file attached
这样,一切正常。
这是预期的行为还是错误?提前谢谢。
【问题讨论】:
标签: javascript html node.js http sails.js