UNPKG

k6-node

Version:

CLI tool that enables k6 installation via npm packages

66 lines (65 loc) 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.httpK6Request = httpK6Request; exports.k6GET = k6GET; exports.k6POST = k6POST; exports.k6PUT = k6PUT; exports.k6DELETE = k6DELETE; /** * Create an HTTP request configuration for k6 * k6 will execute this request and collect performance metrics * * @param method - HTTP method (GET, POST, etc.) * @param url - Target URL for the request * @param options - Additional request options like body, params, headers * @returns Request configuration object */ function httpK6Request(method, url, options = {}) { return { method, url, ...options, }; } /** * Create a GET request for k6 * * @param url - Target URL * @param options - Request options excluding method and URL * @returns GET request configuration */ function k6GET(url, options) { return httpK6Request('GET', url, options); } /** * Create a POST request for k6 * * @param url - Target URL * @param body - Request body data * @param options - Request options excluding method, URL and body * @returns POST request configuration */ function k6POST(url, body, options) { return httpK6Request('POST', url, { ...options, body }); } /** * Create a PUT request for k6 * * @param url - Target URL * @param body - Request body data * @param options - Request options excluding method, URL and body * @returns PUT request configuration */ function k6PUT(url, body, options) { return httpK6Request('PUT', url, { ...options, body }); } /** * Create a DELETE request for k6 * * @param url - Target URL * @param options - Request options excluding method and URL * @returns DELETE request configuration */ function k6DELETE(url, options) { return httpK6Request('DELETE', url, options); }