valid-url
valid-url copied to clipboard
False positives
var validator = require('valid-url');
console.log( validator.isWebUri('http://foo') );
prints http://foo
(e.g. true), which is not correct. There is no TLD. Valid URLs will have at least one dot and 1 character after the dot.
Let me check whether this is the behavior of the original perl module or whether it is a bug introduced by me in the "translation". It appears that based on the original spec, the perl module would reject "relative hostnames" as opposed to accept them per RFC, which is the behavior you advocate as well
So, in summary what you are pointing is a bug. i couldn't find anywhere in the perl code the part that is enforcing what he describes in the spec, ie that the authority
is an actual TLD. It may take me a couple days to find the time to fix this. (out of job - trying to start my next company)
This is not bug.
It is a valid URL. For example, you can declare 'foo' in /etc/hosts
file for localhost or in your local network DNS-server for resolving internal hosts.