UNPKG

fluentrest-ts

Version:

A lightweight, fluent TypeScript API testing library inspired by Java's RestAssured. Built on top of Axios, JSONPath, and Joi for powerful request handling and response validation.

24 lines (23 loc) 960 B
import { AxiosRequestConfig } from "axios"; import { LogLevel } from "./logger"; import { ResponseValidatorImpl } from "./response-validator"; /** * Responsible for executing HTTP requests using Axios, * capturing both successful and failed responses, * and wrapping the result in a ResponseValidator. */ export declare class RequestExecutor { private config; private logLevel; private logToFile; constructor(config: Partial<AxiosRequestConfig>, logLevel: LogLevel, logToFile: boolean); /** * Sends the HTTP request using the provided method and endpoint. * Ensures that no exception is thrown on non-2xx responses. * Returns a ResponseValidator containing the response or error. * * @param method - HTTP method (e.g., "get", "post", etc.) * @param endpoint - Target URL or path */ send(method: string, endpoint: string, overrides?: Partial<AxiosRequestConfig>): Promise<ResponseValidatorImpl>; }