Skip to content

Commit

Permalink
Fix redirects under async load (denoland#2133)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkassimo authored and ry committed Apr 19, 2019
1 parent f03280e commit afabb3f
Show file tree
Hide file tree
Showing 2 changed files with 273 additions and 62 deletions.
12 changes: 10 additions & 2 deletions cli/worker.rs
Expand Up @@ -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
Expand All @@ -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,
}),
)
}

Expand Down

0 comments on commit afabb3f

Please sign in to comment.