-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slowing down the response #8
Comments
Pretty nice idea! Give me some time to figure out the way to make it out. |
Great! |
Yay! @avanderhoorn, is it ok for you? var mock = require('superagent-mocker');
// set just number
mock.timeout = 100;
// Or function to get random
mock.timeout = function () {
return Math.random() * 1e4 |0;
} https://github.com/rambler-digital-solutions/superagent-mocker#timeout |
Yep that is nice! I had originally thought about it being configurable on an endpoint by endpoint basis so endpoints that take longer than other, etc could be accounted for but I'll take what I can get and having it work globally does save having to manually setup each one. I also like being able to pass in a function instead of just a int, so nice touch there. |
@avanderhoorn do you want make pull request? :D |
Ya, might be up for it, how would you want the API to look? |
Awesome! What do you think about chained API like require('superagent-mocker')
.get('/topics/:id', function(req) {
return {
id: req.params.id,
content: 'Hello World!'
};
})
.timeout(100)
// or
.timeout(function() { return Math.random() * 1e4 |0; }) |
btw, I can release new version with |
@avanderhoorn published with |
Fantastic! Which commit # was it? |
9db610c but still without ability to setup it for endpoint. You can make PR for it. |
I'm looking at how we can simulate as much as possible what our real/production environment in offline development scenarios. Inline with this, we are fully faking out the server to be used during client dev work.
With this in mind, it would be nice if the api facilitated some way in which once could control when superagents
end
callback gets called? In my case I would call it from within asetTimeout
.The text was updated successfully, but these errors were encountered: