MCPcopy
hub / github.com/21st-dev/magic-mcp / HttpClient

Interface HttpClient

src/utils/http-client.ts:13–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
12
13interface HttpClient {
14 get<T>(
15 endpoint: string,
16 options?: RequestInit
17 ): Promise<{ status: number; data: T }>;
18 post<T>(
19 endpoint: string,
20 data?: unknown,
21 options?: RequestInit
22 ): Promise<{ status: number; data: T }>;
23 put<T>(
24 endpoint: string,
25 data?: unknown,
26 options?: RequestInit
27 ): Promise<{ status: number; data: T }>;
28 delete<T>(
29 endpoint: string,
30 data?: unknown,
31 options?: RequestInit
32 ): Promise<{ status: number; data: T }>;
33 patch<T>(
34 endpoint: string,
35 data?: unknown,
36 options?: RequestInit
37 ): Promise<{ status: number; data: T }>;
38}
39
40const createMethod = (method: HttpMethod) => {
41 return async <T>(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected