Skip to content

Commit

Permalink
fixup! feat: Add --location and globalThis.location
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn committed Jan 6, 2021
1 parent a28b9dc commit ada425b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cli/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1521,8 +1521,8 @@ fn location_arg_parse(
Url::parse(href)
.map_err(|e| e.to_string())
.and_then(|url| {
if !["http", "https", "file"].contains(&url.scheme()) {
Err("Expected protocol \"http\", \"https\" or \"file\"".to_string())
if !["http", "https"].contains(&url.scheme()) {
Err("Expected protocol \"http\" or \"https\"".to_string())
} else {
Ok(url)
}
Expand Down
6 changes: 1 addition & 5 deletions cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2308,11 +2308,7 @@ fn workers() {
.arg("test")
.arg("--reload")
.arg("--location")
.arg(
url::Url::from_directory_path(util::tests_path())
.unwrap()
.as_str(),
)
.arg("http://127.0.0.1:4545/cli/tests/")
.arg("--allow-net")
.arg("--allow-read")
.arg("--unstable")
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/workers_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ Deno.test({
fn: async function (): Promise<void> {
// TODO(nayeemrmn): Add `Location` and `location` to `dlint`'s globals.
// deno-lint-ignore no-undef
assertEquals(location.href, new URL(".", import.meta.url).href);
assertEquals(location.href, "http://127.0.0.1:4545/cli/tests/");
const promise = deferred();
const w = new Worker(
"./subdir/test_worker.ts",
Expand Down
2 changes: 1 addition & 1 deletion docs/runtime/location_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ global from the web. Please read on.

There is no "web page" whose URL we can use for a location in a Deno process. We
instead allow users to emulate a document location by specifying one on the CLI
using the `--location` flag. It can be a `http`, `https` or `file` URL.
using the `--location` flag. It can be a `http` or `https` URL.

```ts
// deno run --location https://example.com/path main.ts
Expand Down

0 comments on commit ada425b

Please sign in to comment.