mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
Fix redirects under async load (#2133)
This commit is contained in:
parent
f03280ead1
commit
afabb3f833
2 changed files with 275 additions and 64 deletions
|
@ -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,
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue