【发布时间】:2015-08-02 15:20:10
【问题描述】:
我正在使用 loadtest nodejs 模块来测试 nodejs 脚本中 API 的压力测试。 Get 调用语法有效,但调用后无效。代码如下。
function optionsObject() {
return {
url: 'http://localhost:3000/api/v2/signup',
maxRequests: 1,
concurrency: 1,
method: 'POST',
contentType: 'applicaton/json',
body: {
password: 'test',
email: 'testobject_1@signup2.com',
name: 'kPYgJ6Rg5wnExt8hTXQIHDn2LaCMsytjhQzp'
}
}
}
loadtest.loadTest(optionsObject(), function (error, result) {
if (error) {
console.log('Got an error: %s', error);
} else {
console.log(result);
}
});
Results:
{
totalRequests: 1,
totalErrors: 1,
totalTimeSeconds: 0.025545716,
rps: 39,
meanLatencyMs: 20,
maxLatencyMs: 20,
percentiles: { '50': 20, '90': 20, '95': 20, '99': 20 },
errorCodes: { '400': 1 }
}
谁能帮我解释一下为什么我收到错误的请求错误 400?
【问题讨论】:
标签: json node.js post load-testing stress-testing