UNPKG

@intuitionrobotics/testelot

Version:
36 lines (35 loc) 1.22 kB
import { Action } from "./Action"; import * as fetch from "node-fetch"; export declare enum HttpMethod { ALL = "all", POST = "post", GET = "get", PATCH = "patch", DELETE = "delete", PUT = "put", OPTIONS = "options", HEAD = "head" } export declare class Action_Http<T extends object = any> extends Action { private readonly headers; private readonly method; private params; private url; private body; private responseStatus; private responseProcessor?; static global_resolveResponseBody: (action: Action<any>, response: fetch.Response) => Promise<any>; protected constructor(method: HttpMethod); setUrl(url: string | ((action: Action<any>) => string)): this; setBody(body: string | T | ((action: Action<any>) => string | T)): this; setParams(params: object): this; addHeader(key: string, value: string | ((action: Action<any>) => string)): this; setResponseStatus(status: number): this; setResponseProcessor(validator?: (response: any) => void): this; private resolveBody; private resolveUrl; private toUrlParams; protected execute(): Promise<any>; private resolveResponseBody; private executeHttpRequest; }