Closed dfedynich closed 6 years ago
Hello, @jameslnewell .
I want to simulate a time gap to get the response. To achieve this goal I use .timeout(timeout : bool|number) function according to your spec. However the call of this function with any arguments throws the exception 'timeout of 0ms exceeded'
.timeout(timeout : bool|number)
var mock = require('xhr-mock'); mock.setup(); mock.get(/(api\/users).*/, function(req, res) { return res.timeout(1000).status(200).body('<h1>Google</h1>'); }); var axios = require('axios'); axios({url: 'api/users'}).then( function(res) { console.log('loaded', res.data); }, function(error) { console.log('ERROR', error); } );
Hi @dfedynich. Can you please try xhr-mock@next where a timeout looks like (req, res) => new Promise(() => {});
xhr-mock@next
(req, res) => new Promise(() => {});
any luck @dfedynich?
Hello, @jameslnewell .
What's Up
I want to simulate a time gap to get the response. To achieve this goal I use
.timeout(timeout : bool|number)
function according to your spec. However the call of this function with any arguments throws the exception 'timeout of 0ms exceeded'Example