1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix proper closing of http request test ssl/proxy servers

This commit is contained in:
Nick O'Leary 2018-05-08 11:26:28 +01:00
parent 20cf91f1dc
commit 2fef6fd1fa
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -68,11 +68,11 @@ describe('HTTP Request Node', function() {
An optional company name []: An optional company name []:
*/ */
}; };
testSslServer = https.createServer(sslOptions,testApp); testSslServer = stoppable(https.createServer(sslOptions,testApp));
testSslServer.listen(testSslPort); testSslServer.listen(testSslPort);
testProxyPort += 1; testProxyPort += 1;
testProxyServer = httpProxy.createProxyServer({target:'http://localhost:' + testPort}); testProxyServer = stoppable(httpProxy.createProxyServer({target:'http://localhost:' + testPort}));
testProxyServer.on('proxyReq', function(proxyReq, req, res, options) { testProxyServer.on('proxyReq', function(proxyReq, req, res, options) {
proxyReq.setHeader('x-testproxy-header', 'foobar'); proxyReq.setHeader('x-testproxy-header', 'foobar');
}); });
@ -217,8 +217,11 @@ describe('HTTP Request Node', function() {
after(function(done) { after(function(done) {
testServer.stop(() => { testServer.stop(() => {
testProxyServer.close(); testProxyServer.stop(() => {
helper.stopServer(done); testSslServer.stop(() => {
helper.stopServer(done);
});
});
}); });
}); });