Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: replace string concatenation with template #16921

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
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