1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00

the scheme bits of an uri is case-insensitive; https://tools.ietf.org/html/rfc3986#section-3.1 (#4909)

This commit is contained in:
Thiago Veronezi 2020-04-26 11:04:02 -04:00 committed by GitHub
parent 62150dd328
commit fe6a670454
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,8 @@ lazy_static! {
}
pub fn is_remote_url(module_url: &str) -> bool {
module_url.starts_with("http://") || module_url.starts_with("https://")
let lower = module_url.to_lowercase();
lower.starts_with("http://") || lower.starts_with("https://")
}
fn validate_exec_name(exec_name: &str) -> Result<(), Error> {
@ -222,6 +223,8 @@ mod tests {
fn test_is_remote_url() {
assert!(is_remote_url("https://deno.land/std/http/file_server.ts"));
assert!(is_remote_url("http://deno.land/std/http/file_server.ts"));
assert!(is_remote_url("HTTP://deno.land/std/http/file_server.ts"));
assert!(is_remote_url("HTTp://deno.land/std/http/file_server.ts"));
assert!(!is_remote_url("file:///dev/deno_std/http/file_server.ts"));
assert!(!is_remote_url("./dev/deno_std/http/file_server.ts"));
}