-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMessage.ts
More file actions
42 lines (39 loc) · 1.1 KB
/
Message.ts
File metadata and controls
42 lines (39 loc) · 1.1 KB
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
import ProxyConfig from './ProxyConfig';
export const NO_RESPONSE = 'No Response';
export enum MessageType {
// eslint-disable-next-line no-unused-vars
REQUEST,
// eslint-disable-next-line no-unused-vars
RESPONSE,
// eslint-disable-next-line no-unused-vars
REQUEST_AND_RESPONSE,
}
export type MessageProtocol =
| 'http:'
| 'https:'
| 'log:'
| 'mongo:'
| 'redis:'
| 'mysql:'
| 'tcp:';
export default class Message {
type: MessageType = MessageType.REQUEST_AND_RESPONSE;
timestamp: number = 0;
sequenceNumber: number = 0;
sequenceNumberRes: number = 0;
requestHeaders: { [key: string]: string } = {};
responseHeaders: { [key: string]: string } = {};
method: string | undefined = '';
protocol: MessageProtocol | '' = '';
url: string | undefined = '';
endpoint: string = '';
requestBody: string | { [key: string]: any } = '';
responseBody: { [key: string]: any } | string = '';
clientIp: string | undefined = '';
serverHost: string = '';
path: string = '';
elapsedTime: number = 0;
status: number = 0;
proxyConfig?: ProxyConfig = undefined;
modified = false;
};