-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
62 lines (53 loc) · 1.78 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
export {}
declare global {
const sharedState: Record<string, any>
namespace proxyman.addons {
type Method = 'ANY' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'PATCH'
type Scheme = 'http' | 'https'
type Flow = {
serverPort: string
serverIpAddress: string
clientIpAddress: string
remoteDeviceName: string | null
remoteDeviceIP: string | null
id: string
clientPath: string | null
clientPort: string
clientName: string | null
}
type Context = {
scriptName: string
matchingRule: string
matchingMethod: Method
isEnableOnRequest: boolean
isEnableOnResponse: boolean
filePath: string
flow?: Flow
}
type Request = {
method: Method
scheme: Scheme
host: string
path: string
port: number
queries: Record<string, any>
headers: Record<string, any>
body?: string | Record<string, any>
bodyFilePath?: string
rawBody?: string
preserveHostHeader: boolean
isURLEncoding: boolean
}
type Response = {
statusCode: number
httpVersion: string
statusPhrase: string
headers: Record<string, any>
body?: string | Record<string, any>
rawBody?: string
bodyFilePath?: string
}
type onRequest = (context: Context, url: string, request: Request) => Request
type onResponse = (context: Context, url: string, request: Request, response: Response) => Response
}
}