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 ff485bd commit 2eba668
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 @@ -703,10 +703,10 @@ module.exports.reportLog = function() {

let requestBody = '';

if (req._body){
if (req._body.length < maxBodySize){
requestBody = req._body.toString('base64')
}else{
if (req._body) {
if (req._body.length < maxBodySize) {
requestBody = req._body.toString('base64');
} else {
requestBody = Buffer.from(`body was too large too show, length: ${req._body.length}`).toString('base64');
}
}
Expand All @@ -718,7 +718,7 @@ module.exports.reportLog = function() {
cache: '',
process: 'TSW:' + process.pid,
resultCode: (res && res.statusCode) || 101,
contentLength: isWebSocket ? 0 : (res.getHeader('content-type') || res._bodySize),
contentLength: isWebSocket ? 0 : (res.getHeader('content-length') || res._bodySize),
contentType: isWebSocket ? 'websocket' : res.getHeader('content-type'),
clientIp: httpUtil.getUserIp(req),
clientPort: req.socket && req.socket.remotePort,
Expand Down

0 comments on commit 2eba668

Please sign in to comment.