summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/nodejs/unit-http/http_server.js2
-rwxr-xr-xtest/node/404/app.js3
-rwxr-xr-xtest/node/basic/app.js4
-rwxr-xr-xtest/node/double_end/app.js3
-rwxr-xr-xtest/node/mirror/app.js4
-rwxr-xr-xtest/node/promise_handler/app.js3
-rwxr-xr-xtest/node/status_message/app.js3
-rwxr-xr-xtest/node/variables/app.js3
-rwxr-xr-xtest/node/write_before_write_head/app.js3
-rwxr-xr-xtest/node/write_buffer/app.js4
-rwxr-xr-xtest/node/write_return/app.js4
11 files changed, 16 insertions, 20 deletions
diff --git a/src/nodejs/unit-http/http_server.js b/src/nodejs/unit-http/http_server.js
index ae8e204a..0fe5dd34 100755
--- a/src/nodejs/unit-http/http_server.js
+++ b/src/nodejs/unit-http/http_server.js
@@ -195,6 +195,8 @@ function writeHead(statusCode, reason, obj) {
}
}
}
+
+ return this;
};
/*
diff --git a/test/node/404/app.js b/test/node/404/app.js
index 9600d486..587c432d 100755
--- a/test/node/404/app.js
+++ b/test/node/404/app.js
@@ -3,6 +3,5 @@
var fs = require('fs');
require('unit-http').createServer(function (req, res) {
- res.writeHead(404, {});
- res.end(fs.readFileSync('404.html'));
+ res.writeHead(404, {}).end(fs.readFileSync('404.html'));
}).listen(7080);
diff --git a/test/node/basic/app.js b/test/node/basic/app.js
index bc8d570a..7820c474 100755
--- a/test/node/basic/app.js
+++ b/test/node/basic/app.js
@@ -1,6 +1,6 @@
#!/usr/bin/env node
require('unit-http').createServer(function (req, res) {
- res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'});
- res.end('Hello World\n');
+ res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'})
+ .end('Hello World\n');
}).listen(7080);
diff --git a/test/node/double_end/app.js b/test/node/double_end/app.js
index d8280917..63912097 100755
--- a/test/node/double_end/app.js
+++ b/test/node/double_end/app.js
@@ -1,6 +1,5 @@
#!/usr/bin/env node
require('unit-http').createServer(function (req, res) {
- res.end();
- res.end();
+ res.end().end();
}).listen(7080);
diff --git a/test/node/mirror/app.js b/test/node/mirror/app.js
index abcb87cb..1488917e 100755
--- a/test/node/mirror/app.js
+++ b/test/node/mirror/app.js
@@ -6,7 +6,7 @@ require('unit-http').createServer(function (req, res) {
body += chunk.toString();
});
req.on('end', () => {
- res.writeHead(200, {'Content-Length': Buffer.byteLength(body)});
- res.end(body);
+ res.writeHead(200, {'Content-Length': Buffer.byteLength(body)})
+ .end(body);
});
}).listen(7080);
diff --git a/test/node/promise_handler/app.js b/test/node/promise_handler/app.js
index 60b0c3bb..51c3666b 100755
--- a/test/node/promise_handler/app.js
+++ b/test/node/promise_handler/app.js
@@ -6,8 +6,7 @@ require('unit-http').createServer(function (req, res) {
res.end();
if (req.headers['x-write-call']) {
- res.writeHead(200, {'Content-Type': 'text/plain'});
- res.write('blah');
+ res.writeHead(200, {'Content-Type': 'text/plain'}).write('blah');
}
Promise.resolve().then(() => {
diff --git a/test/node/status_message/app.js b/test/node/status_message/app.js
index 4f3b064a..e8a798dd 100755
--- a/test/node/status_message/app.js
+++ b/test/node/status_message/app.js
@@ -1,6 +1,5 @@
#!/usr/bin/env node
require('unit-http').createServer(function (req, res) {
- res.writeHead(200, 'blah', {'Content-Type': 'text/plain'});
- res.end();
+ res.writeHead(200, 'blah', {'Content-Type': 'text/plain'}).end();
}).listen(7080);
diff --git a/test/node/variables/app.js b/test/node/variables/app.js
index 4ed94d09..d8cdc20c 100755
--- a/test/node/variables/app.js
+++ b/test/node/variables/app.js
@@ -14,7 +14,6 @@ require('unit-http').createServer(function (req, res) {
res.setHeader('Content-Type', req.headers['content-type']);
res.setHeader('Custom-Header', req.headers['custom-header']);
res.setHeader('Http-Host', req.headers['host']);
- res.writeHead(200, {});
- res.end(body);
+ res.writeHead(200, {}).end(body);
});
}).listen(7080);
diff --git a/test/node/write_before_write_head/app.js b/test/node/write_before_write_head/app.js
index 6e3fb9a9..724b0efb 100755
--- a/test/node/write_before_write_head/app.js
+++ b/test/node/write_before_write_head/app.js
@@ -2,6 +2,5 @@
require('unit-http').createServer(function (req, res) {
res.write('blah');
- res.writeHead(200, {'Content-Type': 'text/plain'});
- res.end();
+ res.writeHead(200, {'Content-Type': 'text/plain'}).end();
}).listen(7080);
diff --git a/test/node/write_buffer/app.js b/test/node/write_buffer/app.js
index f41de2a1..a7623523 100755
--- a/test/node/write_buffer/app.js
+++ b/test/node/write_buffer/app.js
@@ -1,6 +1,6 @@
#!/usr/bin/env node
require('unit-http').createServer(function (req, res) {
- res.writeHead(200, {'Content-Type': 'text/plain'});
- res.end(new Buffer([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]));
+ res.writeHead(200, {'Content-Type': 'text/plain'})
+ .end(new Buffer([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]));
}).listen(7080);
diff --git a/test/node/write_return/app.js b/test/node/write_return/app.js
index 3ae967c6..82dfbc6e 100755
--- a/test/node/write_return/app.js
+++ b/test/node/write_return/app.js
@@ -1,6 +1,6 @@
#!/usr/bin/env node
require('unit-http').createServer(function (req, res) {
- res.writeHead(200, {'Content-Type': 'text/plain'});
- res.end(res.write('body').toString());
+ res.writeHead(200, {'Content-Type': 'text/plain'})
+ .end(res.write('body').toString());
}).listen(7080);