Skip to content

Commit

Permalink
lib: replace string concatenation with template
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
Jayashree S Kumar authored and evanlucas committed Nov 13, 2017
1 parent a935806 commit df18174
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/_http_server.js
Expand Up @@ -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;
};

Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit df18174

Please sign in to comment.