ermakovich/pptr-mock-server

Feature request: Promise/Async request response

Closed this issue · 4 comments

It would be really nice if we could return a promise as the request response so we can control exactly when the request returns a response or an error.

e.g. I'm writing a unit test where the page makes a request, and I need the request to get a response only after I make some other action. I can get it working with the delay option, although that's not really reliable since I can't guarantee for sure that the action after the request will be finished before the delay ends.

Probably the easiest solution in this case is to make delay parameter to optionally accept a promise, that can be manually resolved at needed moment?

That would work great for me! Let me know if you need any help implementing that.

released in v1.1.0

Thank you so much!