diff options
Diffstat (limited to 'test/node')
-rwxr-xr-x | test/node/double_end/app.js | 6 | ||||
-rwxr-xr-x | test/node/get_header_names/app.js | 8 | ||||
-rwxr-xr-x | test/node/has_header/app.js | 6 | ||||
-rwxr-xr-x | test/node/header_name_case/app.js | 8 | ||||
-rwxr-xr-x | test/node/header_name_valid/app.js | 7 | ||||
-rwxr-xr-x | test/node/header_value_object/app.js | 6 | ||||
-rwxr-xr-x | test/node/promise_end/app.js | 16 | ||||
-rwxr-xr-x | test/node/promise_handler/app.js | 18 | ||||
-rwxr-xr-x | test/node/remove_header/app.js | 2 | ||||
-rwxr-xr-x | test/node/write_multiple/app.js | 8 |
10 files changed, 84 insertions, 1 deletions
diff --git a/test/node/double_end/app.js b/test/node/double_end/app.js new file mode 100755 index 00000000..d8280917 --- /dev/null +++ b/test/node/double_end/app.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + res.end(); + res.end(); +}).listen(7080); diff --git a/test/node/get_header_names/app.js b/test/node/get_header_names/app.js new file mode 100755 index 00000000..4cbccc16 --- /dev/null +++ b/test/node/get_header_names/app.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + res.setHeader('DATE', ['date1', 'date2']); + res.setHeader('X-Header', 'blah'); + res.setHeader('X-Names', res.getHeaderNames()); + res.end(); +}).listen(7080); diff --git a/test/node/has_header/app.js b/test/node/has_header/app.js new file mode 100755 index 00000000..040f551e --- /dev/null +++ b/test/node/has_header/app.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + res.setHeader('X-Has-Header', res.hasHeader(req['headers']['X-Header']) + ''); + res.end(); +}).listen(7080); diff --git a/test/node/header_name_case/app.js b/test/node/header_name_case/app.js new file mode 100755 index 00000000..490bd4d5 --- /dev/null +++ b/test/node/header_name_case/app.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + res.setHeader('X-Header', '1'); + res.setHeader('X-header', '2'); + res.setHeader('X-HEADER', '3'); + res.end(); +}).listen(7080); diff --git a/test/node/header_name_valid/app.js b/test/node/header_name_valid/app.js new file mode 100755 index 00000000..425f026f --- /dev/null +++ b/test/node/header_name_valid/app.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + res.writeHead(200, {}); + res.setHeader('@$', 'test'); + res.end(); +}).listen(7080); diff --git a/test/node/header_value_object/app.js b/test/node/header_value_object/app.js new file mode 100755 index 00000000..ff4e2bb0 --- /dev/null +++ b/test/node/header_value_object/app.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + res.setHeader('X-Header', {}); + res.end(); +}).listen(7080); diff --git a/test/node/promise_end/app.js b/test/node/promise_end/app.js new file mode 100755 index 00000000..ed22464c --- /dev/null +++ b/test/node/promise_end/app.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node + +var fs = require('fs'); + +require('unit-http').createServer(function (req, res) { + res.write('blah'); + + Promise.resolve().then(() => { + res.end(); + }); + + req.on('data', (data) => { + fs.appendFile('callback', '', function() {}); + }); + +}).listen(7080); diff --git a/test/node/promise_handler/app.js b/test/node/promise_handler/app.js new file mode 100755 index 00000000..54df09d1 --- /dev/null +++ b/test/node/promise_handler/app.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +var fs = require('fs'); + +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'); + } + + Promise.resolve().then(() => { + req.on('data', (data) => { + fs.appendFile(data.toString(), '', function() {}); + }); + }); +}).listen(7080); diff --git a/test/node/remove_header/app.js b/test/node/remove_header/app.js index 28fee16d..578b72a7 100755 --- a/test/node/remove_header/app.js +++ b/test/node/remove_header/app.js @@ -4,7 +4,7 @@ require('unit-http').createServer(function (req, res) { res.setHeader('X-Header', 'test'); res.setHeader('Was-Header', res.hasHeader('X-Header').toString()); - res.removeHeader('X-Header'); + res.removeHeader(req['headers']['X-Remove']); res.setHeader('Has-Header', res.hasHeader('X-Header').toString()); res.end(); diff --git a/test/node/write_multiple/app.js b/test/node/write_multiple/app.js new file mode 100755 index 00000000..3cbb3b86 --- /dev/null +++ b/test/node/write_multiple/app.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain', 'Content-Length': 14}); + res.write('write'); + res.write('write2'); + res.end('end'); +}).listen(7080); |