Skip to content

Commit df18174

Browse files
Jayashree S Kumarevanlucas
Jayashree S Kumar
authored andcommitted
lib: replace string concatenation with template
PR-URL: #16921 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent a935806 commit df18174

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/_http_server.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ ServerResponse.prototype.detachSocket = function detachSocket(socket) {
176176
};
177177

178178
ServerResponse.prototype.writeContinue = function writeContinue(cb) {
179-
this._writeRaw('HTTP/1.1 100 Continue' + CRLF + CRLF, 'ascii', cb);
179+
this._writeRaw(`HTTP/1.1 100 Continue${CRLF}${CRLF}`, 'ascii', cb);
180180
this._sent100 = true;
181181
};
182182

@@ -230,7 +230,7 @@ function writeHead(statusCode, reason, obj) {
230230
if (checkInvalidHeaderChar(this.statusMessage))
231231
throw new errors.Error('ERR_INVALID_CHAR', 'statusMessage');
232232

233-
var statusLine = 'HTTP/1.1 ' + statusCode + ' ' + this.statusMessage + CRLF;
233+
var statusLine = `HTTP/1.1 ${statusCode} ${this.statusMessage}${CRLF}`;
234234

235235
if (statusCode === 204 || statusCode === 304 ||
236236
(statusCode >= 100 && statusCode <= 199)) {
@@ -456,7 +456,7 @@ function onParserExecute(server, socket, parser, state, ret, d) {
456456
}
457457

458458
const badRequestResponse = Buffer.from(
459-
'HTTP/1.1 400 ' + STATUS_CODES[400] + CRLF + CRLF, 'ascii'
459+
`HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}${CRLF}`, 'ascii'
460460
);
461461
function socketOnError(e) {
462462
// Ignore further errors

0 commit comments

Comments
 (0)