mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +03:00
38be3b2e18
Co-authored-by: Jay <jasonsaayman@gmail.com>
17 lines
385 B
JavaScript
17 lines
385 B
JavaScript
import url from 'url';
|
|
|
|
export default function (req, res) {
|
|
const parsedUrl = url.parse(req.url, true);
|
|
const delay = parsedUrl.query.delay || 3000;
|
|
|
|
setTimeout(() => {
|
|
res.writeHead(200, {
|
|
'Content-Type': 'text/json'
|
|
});
|
|
res.write(JSON.stringify({
|
|
message: 'Response completed successfully after ' + delay + 'ms'
|
|
}));
|
|
res.end();
|
|
}, delay);
|
|
};
|