summaryrefslogtreecommitdiff
path: root/cli/ops/fetch.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-11-13 23:14:48 -0500
committerRy Dahl <ry@tinyclouds.org>2019-11-13 23:42:35 -0500
commitfdf0ede2acd110ba04857d5674db19c908b3ff32 (patch)
tree880252cadf6dd5024fe4d32dca7ab903af55e713 /cli/ops/fetch.rs
parentfd62379eafde6571f126df5650b80cfda9f74229 (diff)
Revert "refactor: per-worker resource table (#3306)"
This patch does not work with the recent bundler changes (#3325). Unfortunately I didn't merge master before landing this patch. It has something to do with console.log not working inside the compiler worker. This reverts commit fd62379eafde6571f126df5650b80cfda9f74229.
Diffstat (limited to 'cli/ops/fetch.rs')
-rw-r--r--cli/ops/fetch.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/cli/ops/fetch.rs b/cli/ops/fetch.rs
index a1c0fe29c..143331171 100644
--- a/cli/ops/fetch.rs
+++ b/cli/ops/fetch.rs
@@ -1,9 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use super::dispatch_json::{Deserialize, JsonOp, Value};
-use super::io::StreamResource;
-use crate::http_body::HttpBody;
use crate::http_util::get_client;
use crate::ops::json_op;
+use crate::resources;
use crate::state::ThreadSafeState;
use deno::*;
use http::header::HeaderName;
@@ -55,7 +54,6 @@ pub fn op_fetch(
request = request.header(name, v);
}
debug!("Before fetch {}", url);
- let state_ = state.clone();
let future = request.send().map_err(ErrBox::from).and_then(move |res| {
let status = res.status();
let mut res_headers = Vec::new();
@@ -63,9 +61,8 @@ pub fn op_fetch(
res_headers.push((key.to_string(), val.to_str().unwrap().to_owned()));
}
- let body = HttpBody::from(res.into_body());
- let mut table = state_.lock_resource_table();
- let rid = table.add("httpBody", Box::new(StreamResource::HttpBody(body)));
+ let body = res.into_body();
+ let rid = resources::add_reqwest_body(body);
let json_res = json!({
"bodyRid": rid,