-
Notifications
You must be signed in to change notification settings - Fork 17
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
validate http libs are present #63
Comments
like placing a check for |
instead of doing httpLib = httpLibs[String(parsed.protocol)];
if (!httpLib) {
stream.emit('error', new Miniget.MinigetError(`Invalid URL: ${url}`));
return;
} we could do sth like httpLib = httpLibs[String(parsed.protocol)];
if (!httpLibs.hasOwnProperty(parsed.protocol)) {
stream.emit('error', new Miniget.MinigetError(`Invalid URL protocol: ${url}`));
return;
} else if (!httpLib) {
stream.emit('error', new Miniget.MinigetError(`unable to access http(s) library`));
return;
} |
can you give an example of when the above would give the 2nd error? |
from what i understood an invalid polyfill would result in the |
ah i see what you mean now, this results in better error reporting. i support this |
i am really thinking about renaming this https://github.com/fent/node-miniget/blob/master/src/index.ts#L165
or adding a check after https://github.com/fent/node-miniget/blob/master/src/index.ts#L11
just to make sure that people don't screw up when replacing them e.g. when using in a browser
The text was updated successfully, but these errors were encountered: