@gatling.io/http
Version:
Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).
419 lines (418 loc) • 18.1 kB
TypeScript
import { Session, Wrapper } from "@gatling.io/core";
import JvmBodyPart = io.gatling.javaapi.http.BodyPart;
export interface BodyPart extends Wrapper<JvmBodyPart> {
/**
* Define the contentType attribute
*
* @param contentType - the contentType attribute, expressed as a Gatling Expression Language String
* @returns a new BodyPart instance
*/
contentType(contentType: string): BodyPart;
/**
* Define the contentType attribute
*
* @param contentType - the contentType attribute, expressed as a function
* @returns a new BodyPart instance
*/
contentType(contentType: (session: Session) => string): BodyPart;
/**
* Define the charset attribute
*
* @param charset - the static charset attribute
* @returns a new BodyPart instance
*/
charset(charset: string): BodyPart;
/**
* Define the dispositionType attribute
*
* @param dispositionType - the dispositionType attribute, expressed as a Gatling Expression
* Language String
* @returns a new BodyPart instance
*/
dispositionType(dispositionType: string): BodyPart;
/**
* Define the dispositionType attribute
*
* @param dispositionType - the dispositionType attribute, expressed as a function
* @returns a new BodyPart instance
*/
dispositionType(dispositionType: (session: Session) => string): BodyPart;
/**
* Define the fileName attribute
*
* @param fileName - the fileName attribute, expressed as a Gatling Expression Language String
* @returns a new BodyPart instance
*/
fileName(fileName: string): BodyPart;
/**
* Define the fileName attribute
*
* @param fileName - the fileName attribute, expressed as a function
* @returns a new BodyPart instance
*/
fileName(fileName: (session: Session) => string): BodyPart;
/**
* Define the contentId attribute
*
* @param contentId - the contentId attribute, expressed as a Gatling Expression Language String
* @returns a new BodyPart instance
*/
contentId(contentId: string): BodyPart;
/**
* Define the contentId attribute
*
* @param contentId - the contentId attribute, expressed as a function
* @returns a new BodyPart instance
*/
contentId(contentId: (session: Session) => string): BodyPart;
/**
* Define the transferEncoding attribute
*
* @param transferEncoding - the static transferEncoding attribute
* @returns a new BodyPart instance
*/
transferEncoding(transferEncoding: string): BodyPart;
/**
* Define a header
*
* @param name - the header name, expressed as a Gatling Expression Language String
* @param value - the header value, expressed as a Gatling Expression Language String
* @returns a new BodyPart instance
*/
header(name: string, value: string): BodyPart;
/**
* Define a header
*
* @param name - the header name, expressed as a Gatling Expression Language String
* @param value - the header value, expressed as a function
* @returns a new BodyPart instance
*/
header(name: string, value: (session: Session) => string): BodyPart;
/**
* Define a header
*
* @param name - the header name, expressed as a function
* @param value - the header value, expressed as a Gatling Expression Language String
* @returns a new BodyPart instance
*/
header(name: (session: Session) => string, value: string): BodyPart;
/**
* Define a header
*
* @param name - the header name, expressed as a function
* @param value - the header value, expressed as a function
* @returns a new BodyPart instance
*/
header(name: (session: Session) => string, value: (session: Session) => string): BodyPart;
}
export declare const wrapBodyPart: (_underlying: JvmBodyPart) => BodyPart;
export interface ElFileBodyPartFunction {
/**
* Bootstrap a {@link BodyPart} backed by a file whose text context will be interpreted as a
* Gatling Expression Language String. The name of the part is equal to the file name.
*
* @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 the next DSL step
*/
(filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file whose text context will be interpreted as a
* Gatling Expression Language String The name of the part is equal to the file name.
*
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(filePath: (session: Session) => string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file whose text context will be interpreted as a
* Gatling Expression Language String.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @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 the next DSL step
*/
(name: string, filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file whose text context will be interpreted as a
* Gatling Expression Language String.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(name: string, filePath: (session: Session) => string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file whose text context will be interpreted as a
* Gatling Expression Language String.
*
* @param name - the name of the part, expressed as a function
* @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 the next DSL step
*/
(name: (session: Session) => string, filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file whose text context will be interpreted as a
* Gatling Expression Language String.
*
* @param name - the name of the part, expressed as a function
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(name: (session: Session) => string, filePath: (session: Session) => string): BodyPart;
}
export declare const ElFileBodyPart: ElFileBodyPartFunction;
export interface StringBodyPartFunction {
/**
* Bootstrap a {@link BodyPart} backed by a String
*
* @param string - the string, interpreted as a Gatling Expression Language String
* @returns the next DSL step
*/
(string: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a String
*
* @param string - the string, expressed as a function
* @returns the next DSL step
*/
(string: (session: Session) => string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a String
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param string - the string, interpreted as a Gatling Expression Language String
* @returns the next DSL step
*/
(name: string, string: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a String
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param string - the string, interpreted as a function
* @returns the next DSL step
*/
(name: string, string: (session: Session) => string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a String
*
* @param name - the name of the part, expressed as a function
* @param string - the string, interpreted as a Gatling Expression Language String
* @returns the next DSL step
*/
(name: (session: Session) => string, string: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a String
*
* @param name - the name of the part, expressed as a function
* @param string - the string, interpreted as a function
* @returns the next DSL step
*/
(name: (session: Session) => string, string: (session: Session) => string): BodyPart;
}
export declare const StringBodyPart: StringBodyPartFunction;
export interface RawFileBodyPartFunction {
/**
* Bootstrap a {@link BodyPart} backed by a file, whose bytes will be sent as is. The name of the
* part is equal to the name of the file.
*
* @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 the next DSL step
*/
(filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose bytes will be sent as is. The name of the
* part is equal to the name of the file.
*
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(filePath: (session: Session) => string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose bytes will be sent as is.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @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 the next DSL step
*/
(name: string, filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose bytes will be sent as is.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(name: string, filePath: (session: Session) => string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose bytes will be sent as is.
*
* @param name - the name of the part, expressed as a function
* @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 the next DSL step
*/
(name: (session: Session) => string, filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose bytes will be sent as is.
*
* @param name - the name of the part, expressed as a function
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(name: (session: Session) => string, filePath: (session: Session) => string): BodyPart;
}
export declare const RawFileBodyPart: RawFileBodyPartFunction;
export interface PebbleFileBodyPartFunction {
/**
* Bootstrap a {@link BodyPart} backed by a file, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template. The name of the part is equal to the
* name of the file.
*
* @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 the next DSL step
*/
(filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template. The name of the part is equal to the
* name of the file.
*
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(filePath: (session: Session) => string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @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 the next DSL step
*/
(name: string, filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(name: string, filePath: (session: Session) => string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template.
*
* @param name - the name of the part, expressed as a function
* @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 the next DSL step
*/
(name: (session: Session) => string, filePath: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a file, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template.
*
* @param name - the name of the part, expressed as a function
* @param filePath - the path of the file, either relative to the root of the classpath, or
* absolute, expressed as a function
* @returns the next DSL step
*/
(name: (session: Session) => string, filePath: (session: Session) => string): BodyPart;
}
export declare const PebbleFileBodyPart: PebbleFileBodyPartFunction;
export interface PebbleStringBodyPartFunction {
/**
* Bootstrap a {@link BodyPart} backed by a String, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template.
*
* @param string - the Pebble String template
* @returns the next DSL step
*/
(string: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a String, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param string - the Pebble String template
* @returns the next DSL step
*/
(name: string, string: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a String, whose content is interpreted as a <a
* href="https://pebbletemplates.io/">Pebble</a> template.
*
* @param name - the name of the part, expressed as a function
* @param string - the Pebble String template
* @returns the next DSL step
*/
(name: (session: Session) => string, string: string): BodyPart;
}
export declare const PebbleStringBodyPart: PebbleStringBodyPartFunction;
export interface ByteArrayBodyPartFunction {
/**
* Bootstrap a {@link BodyPart} backed by a byte array. Bytes are sent as is.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param bytes - the static bytes
* @returns the next DSL step
*/
(name: string, bytes: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a byte array. Bytes are sent as is.
*
* @param name - the name of the part, expressed as a function
* @param bytes - the static bytes
* @returns the next DSL step
*/
(name: (session: Session) => string, bytes: string): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a byte array. Bytes are sent as is.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param bytes - the bytes, expressed as a Gatling Expression Language String
* @returns the next DSL step
*/
(name: string, bytes: number[]): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a byte array. Bytes are sent as is.
*
* @param name - the name of the part, expressed as a function
* @param bytes - the bytes, expressed as a Gatling Expression Language String
* @returns the next DSL step
*/
(name: (session: Session) => string, bytes: number[]): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a byte array. Bytes are sent as is.
*
* @param name - the name of the part, expressed as a Gatling Expression Language String
* @param bytes - the bytes, expressed as a function
* @returns the next DSL step
*/
(name: string, bytes: (session: Session) => number[]): BodyPart;
/**
* Bootstrap a {@link BodyPart} backed by a byte array. Bytes are sent as is.
*
* @param name - the name of the part, expressed as a function
* @param bytes - the bytes, expressed as a function
* @returns the next DSL step
*/
(name: (session: Session) => string, bytes: (session: Session) => number[]): BodyPart;
}
export declare const ByteArrayBodyPart: ByteArrayBodyPartFunction;