Files
node/test/parallel/test-http-multi-line-headers.js
jiangplus 77506e48b0 test: simplify string concatenation
Replace string concatenation with template literals.
Updated `test/parallel/test-http-multi-line-headers.js`

PR-URL: https://github.com/nodejs/node/pull/14278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: David Cai <davidcai1993@yahoo.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-09-05 12:49:55 -04:00

35 lines
851 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
const net = require('net');
const server = net.createServer(function(conn) {
const body = 'Yet another node.js server.';
const response =
'HTTP/1.1 200 OK\r\n' +
'Connection: close\r\n' +
`Content-Length: ${body.length}\r\n` +
'Content-Type: text/plain;\r\n' +
' x-unix-mode=0600;\r\n' +
' name="hello.txt"\r\n' +
'\r\n' +
body;
conn.end(response);
server.close();
});
server.listen(0, common.mustCall(function() {
http.get({
host: '127.0.0.1',
port: this.address().port
}, common.mustCall(function(res) {
assert.strictEqual(res.headers['content-type'],
'text/plain; x-unix-mode=0600; name="hello.txt"');
res.destroy();
}));
}));