我需要一些示例来捕获动态值并将其传递给后续请求。
答案 0 :(得分:0)
您可以通过每个HTTP请求返回的http.Response
对象来完成此操作:https://docs.k6.io/docs/response-k6http
使用httpbin.org的简单示例:
import http from "k6/http";
export default function (data) {
let resp1 = http.get("https://httpbin.org/anything");
let resp2 = http.post("https://httpbin.org/post", { myip: resp1.json().origin });
console.log(resp2.body)
}