File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,10 @@ for winston.
82
82
### ` formatHttpRequest `
83
83
84
84
Function that enhances an ECS object with http request data.
85
- The request object should be Node.js's core request object.
85
+ The request object should be Node.js's core
86
+ [ ` http.IncomingMessage ` ] ( https://nodejs.org/api/all.html#http_class_http_incomingmessage ) ,
87
+ or [ Express's request object] ( https://expressjs.com/en/5x/api.html#req ) that
88
+ extends it.
86
89
87
90
``` js
88
91
const { formatHttpRequest } = require (' @elastic/ecs-helpers' )
@@ -105,7 +108,10 @@ console.log(ecs)
105
108
### ` formatHttpResponse `
106
109
107
110
Function that enhances an ECS object with http response data.
108
- The response object should be Node.js's core response object.
111
+ The response object should be Node.js's core
112
+ [ ` http.ServerResponse ` ] ( https://nodejs.org/api/all.html#http_class_http_serverresponse ) ,
113
+ or [ Express's response object] ( https://expressjs.com/en/5x/api.html#res ) that
114
+ extends it.
109
115
110
116
``` js
111
117
const { formatHttpResponse } = require (' @elastic/ecs-helpers' )
Original file line number Diff line number Diff line change 17
17
},
18
18
"homepage" : " https://github.com/elastic/ecs-logging-nodejs/blob/master/helpers/README.md" ,
19
19
"scripts" : {
20
- "test" : " standard && tap --timeout ${TAP_TIMEOUT:-10} test.js"
20
+ "test" : " standard && tap --timeout ${TAP_TIMEOUT:-10} test/*.test .js"
21
21
},
22
22
"engines" : {
23
23
"node" : " >=10"
28
28
"devDependencies" : {
29
29
"ajv" : " ^7.0.3" ,
30
30
"ajv-formats" : " ^1.5.1" ,
31
+ "express" : " ^4.17.1" ,
31
32
"semver" : " ^7.1.3" ,
32
33
"standard" : " 16.x" ,
33
34
"tap" : " ^14.x"
Original file line number Diff line number Diff line change @@ -24,22 +24,22 @@ const Ajv = require('ajv').default
24
24
const semver = require ( 'semver' )
25
25
const test = require ( 'tap' ) . test
26
26
27
- const { ecsLoggingValidate } = require ( '../utils/lib/ecs-logging-validate' )
27
+ const { ecsLoggingValidate } = require ( '../../ utils/lib/ecs-logging-validate' )
28
28
29
29
const {
30
30
version,
31
31
stringify,
32
32
formatError,
33
33
formatHttpRequest,
34
34
formatHttpResponse
35
- } = require ( './' )
35
+ } = require ( '.. /' )
36
36
37
37
const ajv = new Ajv ( {
38
38
allErrors : true ,
39
39
verbose : true
40
40
} )
41
41
addFormats ( ajv )
42
- const validate = ajv . compile ( require ( '../utils/schema.json' ) )
42
+ const validate = ajv . compile ( require ( '../../ utils/schema.json' ) )
43
43
44
44
test ( 'stringify should return a valid ecs json' , t => {
45
45
const ecsFields = {
You can’t perform that action at this time.
0 commit comments