diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2019-04-18 18:33:50 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-04-18 21:33:50 -0400 |
commit | afabb3f833c80af380432193881769b8a6c1c88d (patch) | |
tree | bef6f2384db8abdc7dba33b0c7eae642f45ae8ca /cli/worker.rs | |
parent | f03280ead1bec16b2c0c33fb980e2db7f58a5933 (diff) |
Fix redirects under async load (#2133)
Diffstat (limited to 'cli/worker.rs')
-rw-r--r-- | cli/worker.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cli/worker.rs b/cli/worker.rs index 5a4299214..a7bc7bb7a 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -162,7 +162,10 @@ impl Loader for Worker { } /// Given an absolute url, load its source code. - fn load(&mut self, url: &str) -> Box<deno::SourceCodeFuture<Self::Error>> { + fn load( + &mut self, + url: &str, + ) -> Box<deno::SourceCodeInfoFuture<Self::Error>> { self .state .metrics @@ -173,7 +176,12 @@ impl Loader for Worker { .map_err(|err| { eprintln!("{}", err); err - }).map(|module_meta_data| module_meta_data.js_source()), + }).map(|module_meta_data| deno::SourceCodeInfo { + // Real module name, might be different from initial URL + // due to redirections. + code: module_meta_data.js_source(), + module_name: module_meta_data.module_name, + }), ) } |