UNPKG

@gatling.io/core

Version:

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

151 lines (150 loc) 5.71 kB
import { Wrapper } from "./common"; import { Session } from "./session"; import JvmBody = io.gatling.javaapi.core.Body; export interface Body extends Wrapper<JvmBody> { } export declare namespace Body { interface WithBytes extends Body { (session: Session): number[]; } interface WithString extends Body { (session: Session): string; } } export interface StringBodyFunction { /** * Create a body from a String. * * <p>Can also be used as a Function<Session, String> to define the expected value in a check. * * @param string - the body expressed as a gatling Expression Language String * @returns a body */ (string: string): Body.WithString; /** * Create a body from a String. * * <p>Can also be used as a Function<Session, String> to define the expected value in a check. * * @param f - the body expressed as a function * @returns a body */ (f: (session: Session) => string): Body.WithString; } export declare const StringBody: StringBodyFunction; export interface RawFileBodyFunction { /** * Create a body from a file. Bytes will be sent without any transformation. * * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check. * * @param filePath - the path of the file, either relative to the root of the classpath, or * absolute, expressed as a Gatling Expression Language String * @returns a body */ (filePath: string): Body.WithBytes; /** * Create a body from a file. Bytes will be sent without any transformation. * * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check. * * @param filePath - the path of the file, either relative to the root of the classpath, or * absolute, expressed as a function * @returns a body */ (filePath: (session: Session) => string): Body.WithBytes; } export declare const RawFileBody: RawFileBodyFunction; export interface ElFileBodyFunction { /** * Create a body from a file. File text content will be processed as a Gatling Expression Language * String. * * <p>Can also be used as a Function<Session, String> to define the expected value in a check. * * @param filePath - the path of the file, either relative to the root of the classpath, or * absolute, expressed as a Gatling Expression Language String * @returns a body */ (filePath: string): Body.WithString; /** * Create a body from a file. File text content will be processed as a Gatling Expression Language * String. * * <p>Can also be used as a Function<Session, String> to define the expected value in a check. * * @param filePath - the path of the file, either relative to the root of the classpath, or * absolute, expressed as a function * @returns a body */ (filePath: (session: Session) => string): Body.WithString; } export declare const ElFileBody: ElFileBodyFunction; export interface PebbleStringBodyFunction { /** * Create a body from String processed as a <a href="https://pebbletemplates.io/">Pebble * template</a>. * * <p>Can also be used as a Function<Session, String> to define the expected value in a check. * * @param string - the Pebble string * @returns a body */ (string: string): Body.WithString; } export declare const PebbleStringBody: PebbleStringBodyFunction; export interface PebbleFileBodyFunction { /** * Create a body from a file. File text content will be processed as a <a * href="https://pebbletemplates.io/">Pebble template</a>. * * <p>Can also be used as a Function<Session, String> to define the expected value in a check. * * @param filePath - the path of the file, either relative to the root of the classpath, or * absolute, expressed as a Gatling Expression Language String * @returns a body */ (filePath: string): Body.WithString; /** * Create a body from a file. File text content will be processed as a <a * href="https://pebbletemplates.io/">Pebble template</a>. * * <p>Can also be used as a Function<Session, String> to define the expected value in a check. * * @param filePath - the path of the file, either relative to the root of the classpath, or * absolute, expressed as a function * @returns a body */ (filePath: (session: Session) => string): Body.WithString; } export declare const PebbleFileBody: PebbleFileBodyFunction; export interface ByteArrayBodyFunction { /** * Create a body from a byte array. Bytes will be sent as is. * * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check. * * @param bytes - the bytes, expressed as a Gatling Expression Language String * @returns a body */ (bytes: string): Body.WithBytes; /** * Create a body from a byte array. Bytes will be sent as is. * * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check. * * @param bytes - the bytes * @returns a body */ (bytes: number[]): Body.WithBytes; /** * Create a body from a byte array. Bytes will be sent as is. * * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check. * * @param bytes - the bytes, expressed as a function * @returns a body */ (bytes: (session: Session) => number[]): Body.WithBytes; } export declare const ByteArrayBody: ByteArrayBodyFunction;