Skip to content

Commit

Permalink
fix: outgoingMessage.prototype._headers is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
jackqqxu committed Jul 19, 2019
1 parent c3744b6 commit 573ab47
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/tsw/util/auto-report/logReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ module.exports.reportLog = function() {
headers: httpUtil.getRequestHeaderStr(req),
body: requestBodyText,
statusCode: res.statusCode,
resHeaders: JSON.stringify(res._headers, null, 2)
resHeaders: JSON.stringify(res.getHeaders())
});
}

Expand All @@ -696,7 +696,7 @@ module.exports.reportLog = function() {
try {

// webapp的二进制回包转成可视化的结构
if (!isWebSocket && res._body && res._headers['content-type'] === 'webapp') {
if (!isWebSocket && res._body && res.getHeader('content-type') === 'webapp') {
res._body = Buffer.from(format.formatBuffer(res._body));
}

Expand All @@ -707,8 +707,8 @@ module.exports.reportLog = function() {
cache: '',
process: 'TSW:' + process.pid,
resultCode: (res && res.statusCode) || 101,
contentLength: isWebSocket ? 0 : (res._headers['content-length'] || res._bodySize),
contentType: isWebSocket ? 'websocket' : res._headers['content-type'],
contentLength: isWebSocket ? 0 : (res.getHeader('content-type') || res._bodySize),
contentType: isWebSocket ? 'websocket' : res.getHeader('content-type'),
clientIp: httpUtil.getUserIp(req),
clientPort: req.socket && req.socket.remotePort,
serverIp: serverInfo.intranetIp,
Expand Down Expand Up @@ -747,7 +747,7 @@ module.exports.reportLog = function() {
const pathName = req.REQUEST.pathname;
const fileName = pathName.substr(pathName.lastIndexOf('/') + 1);
reportData.group = module.exports.fingureCroup({
resHeaders: res._headers,
resHeaders: res.getHeaders(),
reqHeaders: req.headers,
suffix: fileName.indexOf('.') !== -1 ? fileName.substr(fileName.lastIndexOf('.') + 1) : '',
method: req.method,
Expand Down

0 comments on commit 573ab47

Please sign in to comment.