lib: replace string concatenation with template

PR-URL: https://github.com/nodejs/node/pull/16921
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
Jayashree S Kumar 2017-11-10 13:57:00 +05:30 committed by Franziska Hinkelmann
parent 79f805cce1
commit cb87c92694

View File

@ -176,7 +176,7 @@ ServerResponse.prototype.detachSocket = function detachSocket(socket) {
};
ServerResponse.prototype.writeContinue = function writeContinue(cb) {
this._writeRaw('HTTP/1.1 100 Continue' + CRLF + CRLF, 'ascii', cb);
this._writeRaw(`HTTP/1.1 100 Continue${CRLF}${CRLF}`, 'ascii', cb);
this._sent100 = true;
};
@ -230,7 +230,7 @@ function writeHead(statusCode, reason, obj) {
if (checkInvalidHeaderChar(this.statusMessage))
throw new errors.Error('ERR_INVALID_CHAR', 'statusMessage');
var statusLine = 'HTTP/1.1 ' + statusCode + ' ' + this.statusMessage + CRLF;
var statusLine = `HTTP/1.1 ${statusCode} ${this.statusMessage}${CRLF}`;
if (statusCode === 204 || statusCode === 304 ||
(statusCode >= 100 && statusCode <= 199)) {
@ -456,7 +456,7 @@ function onParserExecute(server, socket, parser, state, ret, d) {
}
const badRequestResponse = Buffer.from(
'HTTP/1.1 400 ' + STATUS_CODES[400] + CRLF + CRLF, 'ascii'
`HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}${CRLF}`, 'ascii'
);
function socketOnError(e) {
// Ignore further errors