@web-bee-ru/openapi-axios
Version:
A TypeScript abstraction over Axios for typed requests generated from OpenAPI (Swagger) schemas using openapi-typescript.
19 lines (18 loc) • 838 B
TypeScript
/**
* @description Defines all possible HTTP method types as string literals.
*/
export type MethodType = "get" | "post" | "patch" | "put" | "delete" | "head" | "options";
/**
* @description A constant array of HTTP methods that typically include a request body.
*/
export declare const METHODS_WITH_BODY: readonly ["post", "patch", "put"];
/**
* @description Type that represents any HTTP method from the METHODS_WITH_BODY array.
*/
export type MethodTypeWithBody = (typeof METHODS_WITH_BODY)[number];
/**
* @description Function to check if a given method is one that typically includes a request body.
* @param method - The HTTP method to check.
* @returns A boolean indicating whether the method is one that includes a request body.
*/
export declare function isMethodWithBody(method: string): method is MethodTypeWithBody;