@gatling.io/http
Version:
Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).
111 lines (110 loc) • 5.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ByteArrayBodyPart = exports.PebbleStringBodyPart = exports.PebbleFileBodyPart = exports.RawFileBodyPart = exports.StringBodyPart = exports.ElFileBodyPart = exports.wrapBodyPart = void 0;
const core_1 = require("@gatling.io/core");
const jvm_types_1 = require("@gatling.io/jvm-types");
const wrapBodyPart = (_underlying) => ({
_underlying,
contentType: (contentType) => (0, exports.wrapBodyPart)(typeof contentType === "function"
? _underlying.contentType((0, core_1.underlyingSessionTo)(contentType))
: _underlying.contentType(contentType)),
charset: (charset) => (0, exports.wrapBodyPart)(_underlying.charset(charset)),
dispositionType: (dispositionType) => (0, exports.wrapBodyPart)(typeof dispositionType === "function"
? _underlying.dispositionType((0, core_1.underlyingSessionTo)(dispositionType))
: _underlying.dispositionType(dispositionType)),
fileName: (fileName) => (0, exports.wrapBodyPart)(typeof fileName === "function"
? _underlying.fileName((0, core_1.underlyingSessionTo)(fileName))
: _underlying.fileName(fileName)),
contentId: (contentId) => (0, exports.wrapBodyPart)(typeof contentId === "function"
? _underlying.contentId((0, core_1.underlyingSessionTo)(contentId))
: _underlying.contentId(contentId)),
transferEncoding: (transferEncoding) => (0, exports.wrapBodyPart)(_underlying.transferEncoding(transferEncoding)),
header: (name, value) => (0, exports.wrapBodyPart)(typeof name === "function"
? typeof value === "function"
? _underlying.header((0, core_1.underlyingSessionTo)(name), (0, core_1.underlyingSessionTo)(value))
: _underlying.header((0, core_1.underlyingSessionTo)(name), value)
: typeof value === "function"
? _underlying.header(name, (0, core_1.underlyingSessionTo)(value))
: _underlying.header(name, value))
});
exports.wrapBodyPart = wrapBodyPart;
const bodyPartImpl = (jvmBodyPart) => (arg0, arg1) => {
if (arg1 === undefined) {
if (typeof arg0 === "function") {
return (0, exports.wrapBodyPart)(jvmBodyPart((0, core_1.underlyingSessionTo)(arg0)));
}
else {
return (0, exports.wrapBodyPart)(jvmBodyPart(arg0));
}
}
else {
if (typeof arg0 === "function") {
if (typeof arg1 === "function") {
return (0, exports.wrapBodyPart)(jvmBodyPart((0, core_1.underlyingSessionTo)(arg0), (0, core_1.underlyingSessionTo)(arg1)));
}
else {
return (0, exports.wrapBodyPart)(jvmBodyPart((0, core_1.underlyingSessionTo)(arg0), arg1));
}
}
else {
if (typeof arg1 === "function") {
return (0, exports.wrapBodyPart)(jvmBodyPart(arg0, (0, core_1.underlyingSessionTo)(arg1)));
}
else {
return (0, exports.wrapBodyPart)(jvmBodyPart(arg0, arg1));
}
}
}
};
const ElFileBodyPart = (arg0, arg1) => bodyPartImpl(jvm_types_1.HttpDsl.ElFileBodyPart)(arg0, arg1);
exports.ElFileBodyPart = ElFileBodyPart;
const StringBodyPart = (arg0, arg1) => bodyPartImpl(jvm_types_1.HttpDsl.StringBodyPart)(arg0, arg1);
exports.StringBodyPart = StringBodyPart;
const RawFileBodyPart = (arg0, arg1) => bodyPartImpl(jvm_types_1.HttpDsl.RawFileBodyPart)(arg0, arg1);
exports.RawFileBodyPart = RawFileBodyPart;
const PebbleFileBodyPart = (arg0, arg1) => bodyPartImpl(jvm_types_1.HttpDsl.PebbleFileBodyPart)(arg0, arg1);
exports.PebbleFileBodyPart = PebbleFileBodyPart;
const PebbleStringBodyPart = (arg0, arg1) => {
if (arg1 === undefined) {
if (typeof arg0 === "function") {
throw Error(`PebbleStringBodyPart() called with invalid arguments ${arg0}, ${arg1}`);
}
else {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.PebbleStringBodyPart(arg0));
}
}
else {
if (typeof arg0 === "function") {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.PebbleStringBodyPart((0, core_1.underlyingSessionTo)(arg0), arg1));
}
else {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.PebbleStringBodyPart(arg0, arg1));
}
}
};
exports.PebbleStringBodyPart = PebbleStringBodyPart;
const ByteArrayBodyPart = (arg0, arg1) => {
if (typeof arg0 === "function") {
if (typeof arg1 === "function") {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.ByteArrayBodyPart((0, core_1.underlyingSessionTo)(arg0), (0, core_1.asByteArrayFunction)((0, core_1.underlyingSessionTo)(arg1))));
}
else if (typeof arg1 === "string") {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.ByteArrayBodyPart((0, core_1.underlyingSessionTo)(arg0), arg1));
}
else {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.ByteArrayBodyPart((0, core_1.underlyingSessionTo)(arg0), (0, core_1.asByteArray)(arg1)));
}
}
else {
if (typeof arg1 === "function") {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.ByteArrayBodyPart(arg0, (0, core_1.asByteArrayFunction)((0, core_1.underlyingSessionTo)(arg1))));
}
else if (typeof arg1 === "string") {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.ByteArrayBodyPart(arg0, arg1));
}
else {
return (0, exports.wrapBodyPart)(jvm_types_1.HttpDsl.ByteArrayBodyPart(arg0, (0, core_1.asByteArray)(arg1)));
}
}
};
exports.ByteArrayBodyPart = ByteArrayBodyPart;