diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2018-10-25 15:43:48 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2018-10-25 15:43:48 +0300 |
commit | 0fdc7c3a55daceb54c034a51b30f06a932236965 (patch) | |
tree | e55e5f320d13934f0dfb742b8c0ec19962f0220d /test/node/variables/app.js | |
parent | 41d3d63758fc3846d5a09afd3b33aac19231942a (diff) | |
download | unit-0fdc7c3a55daceb54c034a51b30f06a932236965.tar.gz unit-0fdc7c3a55daceb54c034a51b30f06a932236965.tar.bz2 |
Tests: Node.js application tests.
Diffstat (limited to '')
-rwxr-xr-x | test/node/variables/app.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/node/variables/app.js b/test/node/variables/app.js new file mode 100755 index 00000000..968afba5 --- /dev/null +++ b/test/node/variables/app.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + let body = ''; + req.on('data', chunk => { + body += chunk.toString(); + }); + req.on('end', () => { + res.setHeader('Request-Method', req.method); + res.setHeader('Request-Uri', req.url); + res.setHeader('Server-Protocol', req.httpVersion); + res.setHeader('Request-Raw-Headers', req.rawHeaders.join()); + res.setHeader('Content-Length', Buffer.byteLength(body)); + 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); + }); +}).listen(7080); |