timeout support when create client or make request

This commit is contained in:
zhangzifa
2019-03-13 14:51:01 +08:00
committed by Jackson Tian
parent 8c9353a007
commit 619a7827de
29 changed files with 1005 additions and 97 deletions

View File

@@ -13,7 +13,13 @@ app.use(bodyParser.json({ type: 'application/*+json' }))
app.get('*', function (req, res) {
console.log('GET req.params: ', req.params);
console.log('GET req.query: ', req.query);
res.send(JSON.stringify(req.query));
if (req.params[0] === '/readTimeoutTest') {
setTimeout(function() {
res.send("something");
}, Number(req.query.timeout) + 100);
} else {
res.send(JSON.stringify(req.query));
}
});
app.post('*', function (req, res) {