@wisdomgarden/cloak-plugin-http
Version:
Making native HTTP requests within Cloak applications.
32 lines (25 loc) • 724 B
TypeScript
import { Plugin, ESObject, CloakPlugins } from "@wisdomgarden/cloak";
interface RequestOptions {
method: 'get' | 'post' | 'put' | 'head' | 'delete' | 'options';
data?: ESObject;
params?: { [key: string]: string | number };
timeout?: number;
headers?: { [key: string]: string };
}
interface HTTPResponse {
status: number;
headers: { [key: string]: string };
url: string;
data?: ESObject;
error?: ESObject;
}
export interface HttpPlugin extends Plugin {
sendRequest(url: string, options?: RequestOptions): Promise<HTTPResponse>;
}
export const register: () => void;
export const Http: HttpPlugin;
declare module "@wisdomgarden/cloak" {
export interface CloakPlugins {
Http: HttpPlugin;
}
}