@@ -17,6 +17,11 @@ interface ResponseEventPayload {
17
17
context : Context ;
18
18
}
19
19
20
+ interface RequestEventPayload {
21
+ req : http . IncomingMessage ;
22
+ context : Context ;
23
+ }
24
+
20
25
interface EventBus extends EventEmitter {
21
26
emit (
22
27
event : "DNS_LOOKUP_SUCCESS" ,
@@ -38,6 +43,10 @@ interface EventBus extends EventEmitter {
38
43
event : "RESPONSE_CLOSE" ,
39
44
payload : ResponseEventPayload
40
45
) : boolean ;
46
+ emit (
47
+ event : "REQUEST_START" ,
48
+ payload : RequestEventPayload
49
+ ) : boolean ;
41
50
42
51
on (
43
52
event : "DNS_LOOKUP_SUCCESS" ,
@@ -59,6 +68,10 @@ interface EventBus extends EventEmitter {
59
68
event : "RESPONSE_CLOSE" ,
60
69
listener : ( payload : ResponseEventPayload ) => void
61
70
) : this;
71
+ on (
72
+ event : "REQUEST_START" ,
73
+ listener : ( payload : RequestEventPayload ) => void
74
+ ) : this;
62
75
63
76
once (
64
77
event : "DNS_LOOKUP_SUCCESS" ,
@@ -80,6 +93,10 @@ interface EventBus extends EventEmitter {
80
93
event : "RESPONSE_CLOSE" ,
81
94
listener : ( payload : ResponseEventPayload ) => void
82
95
) : this;
96
+ once (
97
+ event : "REQUEST_START" ,
98
+ listener : ( payload : RequestEventPayload ) => void
99
+ ) : this;
83
100
}
84
101
85
102
export enum EVENT_LIST {
@@ -105,7 +122,12 @@ export enum EVENT_LIST {
105
122
*
106
123
* Indicates that the underlying connection was terminated.
107
124
*/
108
- RESPONSE_CLOSE = "RESPONSE_CLOSE"
125
+ RESPONSE_CLOSE = "RESPONSE_CLOSE" ,
126
+
127
+ /**
128
+ * Emitted when then http.Request coming
129
+ */
130
+ REQUEST_START = "REQUEST_START" ,
109
131
}
110
132
111
133
let bus : EventBus | undefined ;
0 commit comments