-
Notifications
You must be signed in to change notification settings - Fork 16
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
Only restore the http/https request when used. #25
Conversation
Current coverage is
|
+1 |
@@ -260,6 +258,7 @@ function mockRequest() { | |||
* @param {Number} [delay], response delay time, default is 10. | |||
*/ | |||
exports.http.request = function (url, data, headers, delay) { | |||
getAgent(http).__sourceRequest = getAgent(http).request; | |||
return _request.call(this, http, url, data, headers, delay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If test call mock request twice, retore will be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmh... indeed. Although it's meaningless if user calls the mock request twice(because the later mock will override the previous one), unable to restore to the original one is unacceptable. Will update the PR.
Please add a test case for this change. |
+1 |
I will merge this in command line |
landed 3c1ed43 |
2.0.1 |
PR for #24