Skip to content
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

Maybe it's a bug~ #28

Closed
yalishizhude opened this issue Apr 10, 2016 · 1 comment
Closed

Maybe it's a bug~ #28

yalishizhude opened this issue Apr 10, 2016 · 1 comment

Comments

@yalishizhude
Copy link
Contributor

When superagent send two requests to one router path with diffrent request's body almost the same time.When the second request is sent while mock is dealing with the first request,the first request's body will be overwriten by the second request's body.
For instance.

mock.get('/test', function(req){
  //logic code which costs CPU and long time
  console.log(req.body);
  //first request : {name:"b"}
  //seconde request: {name:"b"}
});

superagent.get('/test').send({name:'a'});
superagent.get('/test').send({name:'b'});

I tried to sovle this problem and it works:

//      setTimeout(function(s) {
        try {
          cb && cb(null, current(state.request));
        } catch (ex) {
          cb && cb(ex, null);
        }
//     }, value(mock.timeout), state);

I tried to fix it in this PR
#29

@serga-kiev
Copy link
Collaborator

PR merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants