How to use the k6/http.file function in k6

To help you get started, we’ve selected a few k6 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github StarpTech / fay / loadtesting / html.js View on Github external
export default function () {
  let data = {
    headerTemplate: http.file(headerFile, "header.html"),
    html: http.file(pageFile, "page.html"),
    format: "A4",
  };
  let res = http.post(__ENV.BASE_URL + "/convert", data);
  check(res, {
    "is status 200": (r) => r.status === 200,
    "is not status 504": (r) => r.status !== 504,
    "is not status 500": (r) => r.status !== 500,
    "is not status 429": (r) => r.status !== 429,
  });
  if (res.status !== 200) {
    failCounter.add(1);
  }
}
github StarpTech / fay / loadtesting / url.js View on Github external
export default function () {
  let data = {
    headerTemplate: http.file(headerFile, "header.html"),
    format: "A4",
    url: "http://localhost:3001/page.html",
  };
  let res = http.post(__ENV.BASE_URL + "/convert", data);
  check(res, {
    "is status 200": (r) => r.status === 200,
    "is not status 504": (r) => r.status !== 504,
    "is not status 500": (r) => r.status !== 500,
    "is not status 429": (r) => r.status !== 429,
  });
  if (res.status !== 200) {
    failCounter.add(1);
  }
}
github StarpTech / fay / loadtesting / html.js View on Github external
export default function () {
  let data = {
    headerTemplate: http.file(headerFile, "header.html"),
    html: http.file(pageFile, "page.html"),
    format: "A4",
  };
  let res = http.post(__ENV.BASE_URL + "/convert", data);
  check(res, {
    "is status 200": (r) => r.status === 200,
    "is not status 504": (r) => r.status !== 504,
    "is not status 500": (r) => r.status !== 500,
    "is not status 429": (r) => r.status !== 429,
  });
  if (res.status !== 200) {
    failCounter.add(1);
  }
}