-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
81 lines (49 loc) · 1.53 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { Server, IncomingMessage, OutgoingMessage } from 'node:http';
type Plugin = (
filePath: string,
request: IncomingMessage,
response: OutgoingMessage
) => Promise<{
mime: string,
body: string | Uint8Array
}>
interface Config {
mocksDir: string
ignore?: RegExp
staticDir?: string
host?: string,
port?: number
proxyFallback?: string
delay?: number
cookies?: { [label: string]: string }
extraHeaders?: string[]
extraMimes?: { [fileExt: string]: string }
plugins?: [filenameTester: RegExp, plugin: Plugin][]
corsAllowed?: boolean,
corsOrigins: string[]
corsMethods: string[]
corsHeaders: string[]
corsExposedHeaders: string[]
corsCredentials: boolean
corsMaxAge: number
onReady?: (address: string) => void
}
export function Mockaton(options: Config): Server
export const jsToJsonPlugin: Plugin
// Utils
export function jwtCookie(cookieName: string, payload: any): string
export function parseJSON(request: IncomingMessage): Promise<any>
export class Commander {
constructor(addr: string)
listMocks(): Promise<Response>
select(file: string): Promise<Response>
bulkSelectByComment(comment: string): Promise<Response>
setRouteIsDelayed(routeMethod: string, routeUrlMask: string, delayed: boolean): Promise<Response>
listCookies(): Promise<Response>
selectCookie(cookieKey: string): Promise<Response>
listComments(): Promise<Response>
setProxyFallback(proxyAddr: string): Promise<Response>
reset(): Promise<Response>
getCorsAllowed(): Promise<Response>
setCorsAllowed(value: boolean): Promise<Response>
}