observe-node 1.0.6 → 1.0.7
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/package.json +1 -1
- package/src/http/express.js +3 -4
package/package.json
CHANGED
package/src/http/express.js
CHANGED
|
@@ -44,6 +44,8 @@ function expressMiddleware(observe, opts = {}) {
|
|
|
44
44
|
return function (req, res, next) {
|
|
45
45
|
const start = Date.now();
|
|
46
46
|
|
|
47
|
+
const capturedRequest = pickRequestBody(req.body, maxRequestBytes);
|
|
48
|
+
|
|
47
49
|
// ✅ capture response body
|
|
48
50
|
let capturedResponse;
|
|
49
51
|
const _json = res.json.bind(res);
|
|
@@ -112,8 +114,6 @@ res.send = (body) => {
|
|
|
112
114
|
// ✅ auth info (don’t log token)
|
|
113
115
|
const hasAuth = !!req.headers.authorization;
|
|
114
116
|
|
|
115
|
-
// ✅ body (only if parsed)
|
|
116
|
-
const requestBody = req.body ? redact(req.body) : undefined;
|
|
117
117
|
|
|
118
118
|
observe.emit({
|
|
119
119
|
event_name: "http.response",
|
|
@@ -136,8 +136,7 @@ res.send = (body) => {
|
|
|
136
136
|
query: req.query, // parsed query object
|
|
137
137
|
query_string: queryString, // raw query string
|
|
138
138
|
params: req.params, // may be empty (see note)
|
|
139
|
-
|
|
140
|
-
bodyPayload: capturedRequest,
|
|
139
|
+
body: capturedRequest
|
|
141
140
|
},
|
|
142
141
|
|
|
143
142
|
response: {
|