aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-css-plugin/src/test/resources/mock-start-server
diff options
context:
space:
mode:
authorTibor Blenessy2020-01-13 11:44:34 +0100
committerGitHub2020-01-13 11:44:34 +0100
commit13d52b7dd495c68c72ad8ab3f5063307bf42cfad (patch)
tree057fd574afec4bd7f32283088c9fa2d8b8c66360 /sonar-css-plugin/src/test/resources/mock-start-server
parentc0ba07e77931f187a788c7b1ab5420ead525e3d3 (diff)
downloadsonar-css-13d52b7dd495c68c72ad8ab3f5063307bf42cfad.tar.bz2
Implement close endpoint to shutdown the Node.js process (#243)
Diffstat (limited to 'sonar-css-plugin/src/test/resources/mock-start-server')
-rw-r--r--sonar-css-plugin/src/test/resources/mock-start-server/failedClose.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/sonar-css-plugin/src/test/resources/mock-start-server/failedClose.js b/sonar-css-plugin/src/test/resources/mock-start-server/failedClose.js
new file mode 100644
index 0000000..3c0039e
--- /dev/null
+++ b/sonar-css-plugin/src/test/resources/mock-start-server/failedClose.js
@@ -0,0 +1,28 @@
+#!/usr/bin/env node
+
+const http = require('http');
+const port = process.argv[2];
+
+const requestHandler = (request, response) => {
+ let data = [];
+ request.on('data', chunk => {
+ data.push(chunk);
+ });
+ if (request.url === '/status') {
+ response.writeHead(200, {'Content-Type': 'text/plain'});
+ response.end('OK!');
+ } else {
+ throw "Failure";
+ }
+};
+
+const server = http.createServer(requestHandler);
+
+server.listen(port, (err) => {
+ if (err) {
+ return console.log('something bad happened', err)
+ }
+
+ console.log(`server is listening on ${port}`)
+});
+