-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
discussShare your constructive thoughts on how to make progress with this issueShare your constructive thoughts on how to make progress with this issueenhancementNew feature or requestNew feature or requestpriority-2Second highest priority, should be worked on as soon as the Priority-1 issues are finishedSecond highest priority, should be worked on as soon as the Priority-1 issues are finishedquestionFurther information is requestedFurther information is requestedtechnicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependencies
Description
I used this a few times:
def is_valid_url?(string) do
[:scheme, :host, :port]
|> Enum.map(&Map.get(URI.parse(string), &1))
|> Enum.all?()
endtest "is_valid_url?/1" do
assert is_valid_url?("http://www.google.com") == true
assert is_valid_url?("http//google.com") == false
assert s_valid_url?("ftp://google.com") == true
assert is_valid_url?("https://google.com/api&url=ok") == true
assert is_valid_url?("http://localhost:3000") == true
assert is_valid_url?("https://localhost") == true
assert is_valid_url?("htt:/google") == false
assert is_valid_url?("www.google.com") == false
endReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
discussShare your constructive thoughts on how to make progress with this issueShare your constructive thoughts on how to make progress with this issueenhancementNew feature or requestNew feature or requestpriority-2Second highest priority, should be worked on as soon as the Priority-1 issues are finishedSecond highest priority, should be worked on as soon as the Priority-1 issues are finishedquestionFurther information is requestedFurther information is requestedtechnicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependencies