@nxtedition/lib 21.0.8 → 21.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/http.js CHANGED
@@ -41,10 +41,23 @@ export async function request(ctx, next) {
41
41
  }
42
42
 
43
43
  ctx.id = req.id = res.id = req.headers['request-id'] || genReqId()
44
- ctx.logger = req.log = res.log = logger.child({ req: { id: req.id, url: req.url } })
45
44
  ctx.signal = ac.signal
46
45
  ctx.method = req.method
47
46
  ctx.query = ctx.url.search.length > 1 ? querystring.parse(ctx.url.search.slice(1)) : {}
47
+ ctx.logger =
48
+ req.log =
49
+ res.log =
50
+ logger.child({
51
+ req: {
52
+ id: req.id,
53
+ url: req.url,
54
+ scheme: ctx.url.protocol,
55
+ host: ctx.url.hostname,
56
+ port: ctx.url.port,
57
+ path: ctx.url.pathname,
58
+ query: ctx.query,
59
+ },
60
+ })
48
61
 
49
62
  if (req.method === 'GET' || req.method === 'HEAD') {
50
63
  req.resume() // Dump the body if there is one.
@@ -67,7 +80,7 @@ export async function request(ctx, next) {
67
80
  this.destroy((reqTimeoutError ??= new createError.RequestTimeout()))
68
81
  })
69
82
  .on('error', function (err) {
70
- reqLogger.error({ err }, 'request error')
83
+ this.log.error({ err }, 'request error')
71
84
  })
72
85
  res
73
86
  .on('timeout', function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "21.0.8",
3
+ "version": "21.0.9",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
package/serializers.js CHANGED
@@ -67,6 +67,11 @@ export default {
67
67
  timing: getTiming(req),
68
68
  method: req.method,
69
69
  url: req.url,
70
+ scheme: req.scheme,
71
+ host: req.host,
72
+ port: req.port,
73
+ path: req.path,
74
+ query: req.query,
70
75
  headers: getHeaders(req),
71
76
  bytesRead: req.bytesRead,
72
77
  bytesReadPerSecond: