我正在使用版本 v0.20.0-dev-dccb254 测试 NTLM 身份验证。运行以下脚本的命令行如下所示: bin\k6.exe run --vus 3 --duration 30s scripts/getOrder.js
import http from "k6/http";
import { check, sleep } from "k6";
export default function() {
let res = http.get("http://user:password@localhost:8247/orders/2377", {auth: "ntlm"});
console.log("Status code: " + res.status);
check(res, {
"status was 200": (r) => r.status == 200
});
sleep(1);
};
每个 VU 的第一个请求都成功,但接下来的请求都失败了。这是 K6 的输出:
duration: 30s, iterations: -
vus: 3, max: 3
INFO[0002] Status code: 200 -
INFO[0002] Status code: 200
INFO[0002] Status code: 200
WARN[0003] Request Failed error="Get http://user:password@localhost:8247/orders/2377: Invalid WWW-Authenticate header"
INFO[0003] Status code: 0
WARN[0003] Request Failed error="Get http://user:password@localhost:8247/orders/2377: Invalid WWW-Authenticate header"
INFO[0003] Status code: 0
...