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
root url parsing needs to be more robust/lenient #1061
Comments
Yes I agree, happy to accept pull requests with tests to improve |
I have implemented some failing tests to cover the problem. I am not sure I have formalized them in the way you wanted, as they purely reflect those specific cases + a few other ones. Tests might be better written by actually testing if nock is really intercepting requests to those problematic root URLs. So consider this to be a WIP, I will get back at it later on. If you already have any sort of feedback, it'll be really appreciated. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions. |
Will get back to it in a couple of weeks |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions. |
@Overdrivr we do a remote hackathon this Friday, wanna join? #1269 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions. |
This issue is still valid and has some tests in progress: #1065. I'm going to pin it for now. |
I'm not necessarily convinced we should make this more lenient, though we should definitely throw an error instead of no-opping when the input is invalid. |
The root URL parsing could benefit from improvements for the following cases:
I would expect either an error thrown if the root URL does not match exactly an expected pattern OR that it could parse correctly all those patterns that are valid root urls (well, valid is not maybe the more appropriate word here. But they can be performed successfully using
request
n co).Since nock is primarily used for testing purposes, being lenient about it should be the best option IMO.
Also, the last case is pretty bad because since the root URL is not interpreted correctly, it is not intercepted at all. Which means a test environment could actually call the API you're trying to nock.
The text was updated successfully, but these errors were encountered: