Skip to content

Add support for delaying responses to mimic real APIs. #29

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

austburn
Copy link

No description provided.

@austburn
Copy link
Author

Wondering what your thoughts might be on this. I'm not too familiar with coffeescript/sinon, so I may need help testing if approved.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling f21ea26 on austburn:api-response-delay into 698898d on localmed:master.

@@ -25,7 +25,9 @@ walker = (app, resourceGroups) ->
headerValue = value['value']
res.setHeader headerName, headerValue
res.setHeader 'Content-Length', Buffer.byteLength(response.body)
res.send response.status, response.body
setTimeout ( ->
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with coffeescript, but this does produce some weirdness when compiled:

return setTimeout((function() {
    return res.send(response.status, response.body);
}), delay);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks normal to me. :)

@tomaswitek
Copy link

👍

@xiaotian-tan
Copy link

Wondering when this could be merged to master?

@ranolf
Copy link

ranolf commented Sep 23, 2016

This would be a very useful feature. I'd rather be able to get it from NPM than having point at austburn:api-response-delay

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

Successfully merging this pull request may close these issues.

6 participants