UNPKG

@gatling.io/core

Version:

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

32 lines (31 loc) 2.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ByteArrayBody = exports.PebbleFileBody = exports.PebbleStringBody = exports.ElFileBody = exports.RawFileBody = exports.StringBody = void 0; const jvm_types_1 = require("@gatling.io/jvm-types"); const byteArrays_1 = require("./gatlingJvm/byteArrays"); const session_1 = require("./session"); const wrapBodyWithBytes = (_underlying) => Object.assign((session) => _underlying.apply(session._underlying), { _underlying }); const wrapBodyWithString = (_underlying) => Object.assign((session) => _underlying.apply(session._underlying), { _underlying }); const StringBody = (string) => wrapBodyWithString(typeof string === "function" ? jvm_types_1.CoreDsl.StringBody((0, session_1.underlyingSessionTo)(string)) : jvm_types_1.CoreDsl.StringBody(string)); exports.StringBody = StringBody; const RawFileBody = (filePath) => wrapBodyWithBytes(typeof filePath === "function" ? jvm_types_1.CoreDsl.RawFileBody((0, session_1.underlyingSessionTo)(filePath)) : jvm_types_1.CoreDsl.RawFileBody(filePath)); exports.RawFileBody = RawFileBody; const ElFileBody = (filePath) => wrapBodyWithString(typeof filePath === "function" ? jvm_types_1.CoreDsl.ElFileBody((0, session_1.underlyingSessionTo)(filePath)) : jvm_types_1.CoreDsl.ElFileBody(filePath)); exports.ElFileBody = ElFileBody; const PebbleStringBody = (string) => wrapBodyWithString(jvm_types_1.CoreDsl.PebbleStringBody(string)); exports.PebbleStringBody = PebbleStringBody; const PebbleFileBody = (filePath) => wrapBodyWithString(typeof filePath === "function" ? jvm_types_1.CoreDsl.PebbleFileBody((0, session_1.underlyingSessionTo)(filePath)) : jvm_types_1.CoreDsl.PebbleFileBody(filePath)); exports.PebbleFileBody = PebbleFileBody; const ByteArrayBody = (bytes) => wrapBodyWithBytes(typeof bytes === "function" ? jvm_types_1.CoreDsl.ByteArrayBody((0, byteArrays_1.asByteArrayFunction)((0, session_1.underlyingSessionTo)(bytes))) : typeof bytes === "string" ? jvm_types_1.CoreDsl.ByteArrayBody(bytes) : jvm_types_1.CoreDsl.ByteArrayBody(bytes)); exports.ByteArrayBody = ByteArrayBody; // TODO registerPebbleExtensions