summaryrefslogtreecommitdiffhomepage
path: root/test/node/promise_handler/app.js
blob: 60b0c3bbcd5573210b774775da54426af03095ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);