@@ -5,26 +5,24 @@ const http = require('http');
5
5
const net = require ( 'net' ) ;
6
6
const dc = require ( 'diagnostics_channel' ) ;
7
7
8
- const onClientRequestStart = dc . channel ( 'http.client.request.start' ) ;
9
- const onClientResponseFinish = dc . channel ( 'http.client.response.finish' ) ;
10
- const onServerRequestStart = dc . channel ( 'http.server.request.start' ) ;
11
- const onServerResponseFinish = dc . channel ( 'http.server.response.finish' ) ;
12
-
13
8
const isHTTPServer = ( server ) => server instanceof http . Server ;
14
9
const isIncomingMessage = ( object ) => object instanceof http . IncomingMessage ;
15
10
const isOutgoingMessage = ( object ) => object instanceof http . OutgoingMessage ;
16
11
const isNetSocket = ( socket ) => socket instanceof net . Socket ;
17
12
18
- onClientRequestStart . subscribe ( common . mustCall ( ( { request } ) => {
13
+ dc . subscribe ( 'http.client.request.start' , common . mustCall ( ( { request } ) => {
19
14
assert . strictEqual ( isOutgoingMessage ( request ) , true ) ;
20
15
} ) ) ;
21
16
22
- onClientResponseFinish . subscribe ( common . mustCall ( ( { request, response } ) => {
17
+ dc . subscribe ( 'http.client.response.finish' , common . mustCall ( ( {
18
+ request,
19
+ response
20
+ } ) => {
23
21
assert . strictEqual ( isOutgoingMessage ( request ) , true ) ;
24
22
assert . strictEqual ( isIncomingMessage ( response ) , true ) ;
25
23
} ) ) ;
26
24
27
- onServerRequestStart . subscribe ( common . mustCall ( ( {
25
+ dc . subscribe ( 'http.server.request.start' , common . mustCall ( ( {
28
26
request,
29
27
response,
30
28
socket,
@@ -36,7 +34,7 @@ onServerRequestStart.subscribe(common.mustCall(({
36
34
assert . strictEqual ( isHTTPServer ( server ) , true ) ;
37
35
} ) ) ;
38
36
39
- onServerResponseFinish . subscribe ( common . mustCall ( ( {
37
+ dc . subscribe ( 'http.server.response.finish' , common . mustCall ( ( {
40
38
request,
41
39
response,
42
40
socket,
0 commit comments