UNPKG

@gatling.io/http

Version:

Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).

36 lines (35 loc) 2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.status = exports.headerRegex = exports.header = exports.currentLocationRegex = exports.currentLocation = void 0; const jvm_types_1 = require("@gatling.io/jvm-types"); const core_1 = require("@gatling.io/core"); /** * Bootstrap a check that capture the response location, eg the landing url in a chain of * redirects * * @returns the next step in the check DSL */ const currentLocation = () => (0, core_1.wrapCheckBuilderFind)(jvm_types_1.HttpDsl.currentLocation()); exports.currentLocation = currentLocation; const currentLocationRegex = (pattern) => (0, core_1.wrapCheckBuilderCaptureGroup)(typeof pattern === "function" ? jvm_types_1.HttpDsl.currentLocationRegex((0, core_1.underlyingSessionTo)(pattern)) : jvm_types_1.HttpDsl.currentLocationRegex(pattern)); exports.currentLocationRegex = currentLocationRegex; const header = (name) => (0, core_1.wrapCheckBuilderMultipleFind)(typeof name === "function" ? jvm_types_1.HttpDsl.header((0, core_1.underlyingSessionTo)(name)) : jvm_types_1.HttpDsl.header(name)); exports.header = header; const headerRegex = (name, pattern) => (0, core_1.wrapCheckBuilderCaptureGroup)(typeof name === "function" ? typeof pattern === "function" ? jvm_types_1.HttpDsl.headerRegex((0, core_1.underlyingSessionTo)(name), (0, core_1.underlyingSessionTo)(pattern)) : jvm_types_1.HttpDsl.headerRegex((0, core_1.underlyingSessionTo)(name), pattern) : typeof pattern === "function" ? jvm_types_1.HttpDsl.headerRegex(name, (0, core_1.underlyingSessionTo)(pattern)) : // FIXME forced to use the charsequence version jvm_types_1.HttpDsl.headerRegex(name, pattern)); exports.headerRegex = headerRegex; /** * Bootstrap a check that capture the response HTTP status code * * @returns the next step in the check DSL */ const status = () => (0, core_1.wrapCheckBuilderFind)(jvm_types_1.HttpDsl.status()); exports.status = status;