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

improve reset(): it should fully reset instance and restore defaults #141

Merged
merged 2 commits into from
Aug 17, 2018

Conversation

koskokos2
Copy link
Contributor

  1. reset removes internal WRITE and HEADER handlers with no chance to restore behaviour set in Constructor
  2. event listeners should should be restored to default state as reset implies need to reinitialise instance, so it will be more consistent

1. reset removes internal WRITE and HEADER handlers with no chance to restore behaviour set in Constructor
2. event listeners should should be restored to default state as reset implies need to reinitialise instance, so it will be more consistent
@JCMais
Copy link
Owner

JCMais commented Aug 16, 2018

Thanks!

This is a breaking change for current behavior (even if it's currently wrong), so I will include in a next major release.

Can you fix the failing test?

curl.on('error', function(err, curlCode) {
//curlCode == 3 -> Invalid URL
done(curlCode === 3 ? undefined : err);
});

Since the event listeneres are erased, the error callback there is not going to be called the second time, so you need to add it inside the end callback again.

@koskokos2
Copy link
Contributor Author

fixed test

@JCMais
Copy link
Owner

JCMais commented Aug 17, 2018

Thank you!

@JCMais JCMais merged commit f5dd3d8 into JCMais:develop Aug 17, 2018
@koskokos2 koskokos2 deleted the patch-2 branch August 17, 2018 14:06
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.

2 participants