@gatling.io/http
Version:
Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).
166 lines (165 loc) • 5.83 kB
TypeScript
import { Session } from "@gatling.io/core";
import { HttpProtocolBuilder } from "./protocol";
import { HttpRequestActionBuilder, Request } from "./request";
import { Response } from "./response";
export * from "./bodyPart";
export * from "./checks";
export * from "./cookies";
export * from "./feeders";
export * from "./headers";
export * from "./method";
export * from "./polling";
export * from "./protocol";
export * from "./proxy";
export * from "./request";
export * from "./response";
export * from "./ws";
export * from "./sse";
import JvmRequest = io.gatling.http.client.Request;
import JvmResponse = io.gatling.http.response.Response;
import JvmSession = io.gatling.javaapi.core.Session;
export type RequestTransform = (request: Request, session: Session) => Request;
export declare const underlyingRequestTransform: (f: RequestTransform) => ((jvmRequest: JvmRequest, jvmSession: JvmSession) => JvmRequest);
export type ResponseTransform = (response: Response, session: Session) => Response;
export declare const underlyingResponseTransform: (f: ResponseTransform) => ((jvmResponse: JvmResponse, jvmSession: JvmSession) => JvmResponse);
/**
* DSL for bootstrapping HTTP requests.
*
* <p>Immutable, so all methods return a new occurrence and leave the original unmodified.
*/
export interface Http {
/**
* Define a GET request
*
* @param url - the url, expressed as a Gatling Expression Language String
* @returns a new instance of HttpRequestActionBuilder
*/
get(url: string): HttpRequestActionBuilder;
/**
* Define a GET request
*
* @param url - the url, expressed as a function
* @returns a new instance of HttpRequestActionBuilder
*/
get(url: (session: Session) => string): HttpRequestActionBuilder;
/**
* Define a PUT request
*
* @param url - the url, expressed as a Gatling Expression Language String
* @returns a new instance of HttpRequestActionBuilder
*/
put(url: string): HttpRequestActionBuilder;
/**
* Define a PUT request
*
* @param url - the url, expressed as a function
* @returns a new instance of HttpRequestActionBuilder
*/
put(url: (session: Session) => string): HttpRequestActionBuilder;
/**
* Define a POST request
*
* @param url - the url, expressed as a Gatling Expression Language String
* @returns a new instance of HttpRequestActionBuilder
*/
post(url: string): HttpRequestActionBuilder;
/**
* Define a POST request
*
* @param url - the url, expressed as a function
* @returns a new instance of HttpRequestActionBuilder
*/
post(url: (session: Session) => string): HttpRequestActionBuilder;
/**
* Define a PATCH request
*
* @param url - the url, expressed as a Gatling Expression Language String
* @returns a new instance of HttpRequestActionBuilder
*/
patch(url: string): HttpRequestActionBuilder;
/**
* Define a PATCH request
*
* @param url - the url, expressed as a function
* @returns a new instance of HttpRequestActionBuilder
*/
patch(url: (session: Session) => string): HttpRequestActionBuilder;
/**
* Define a HEAD request
*
* @param url - the url, expressed as a Gatling Expression Language String
* @returns a new instance of HttpRequestActionBuilder
*/
head(url: string): HttpRequestActionBuilder;
/**
* Define a HEAD request
*
* @param url - the url, expressed as a function
* @returns a new instance of HttpRequestActionBuilder
*/
head(url: (session: Session) => string): HttpRequestActionBuilder;
/**
* Define a DELETE request
*
* @param url - the url, expressed as a Gatling Expression Language String
* @returns a new instance of HttpRequestActionBuilder
*/
delete(url: string): HttpRequestActionBuilder;
/**
* Define a DELETE request
*
* @param url - the url, expressed as a function
* @returns a new instance of HttpRequestActionBuilder
*/
delete(url: (session: Session) => string): HttpRequestActionBuilder;
/**
* Define a OPTIONS request
*
* @param url - the url, expressed as a Gatling Expression Language String
* @returns a new instance of HttpRequestActionBuilder
*/
options(url: string): HttpRequestActionBuilder;
/**
* Define a OPTIONS request
*
* @param url - the url, expressed as a function
* @returns a new instance of HttpRequestActionBuilder
*/
options(url: (session: Session) => string): HttpRequestActionBuilder;
/**
* Define a HTTP request
*
* @param method - the HTTP method
* @param url - the url, expressed as a Gatling Expression Language String
* @returns a new instance of HttpRequestActionBuilder
*/
httpRequest(method: string, url: string): HttpRequestActionBuilder;
/**
* Define a HTTP request
*
* @param method - the HTTP method
* @param url - the url, expressed as a function
* @returns a new instance of HttpRequestActionBuilder
*/
httpRequest(method: string, url: (session: Session) => string): HttpRequestActionBuilder;
}
/**
* The entrypoint of the Gatling HTTP DSL
*/
export interface HttpApply {
/**
* Bootstrap a HTTP request configuration
*
* @param name - the HTTP request name, expressed as a Gatling Expression Language String
* @returns the next DSL step
*/
(name: string): Http;
/**
* Bootstrap a HTTP request configuration
*
* @param name - the HTTP request name, expressed as a function
* @returns the next DSL step
*/
(name: (session: Session) => string): Http;
}
export declare const http: HttpApply & HttpProtocolBuilder;