diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-09-15 16:15:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-15 16:15:01 -0400 |
commit | 0715803b7fdf6399f447f9fd2fdd2aa8b41beac7 (patch) | |
tree | 657d020cfec478f25a3bba6debf3c8965abc27f7 /cli/ops/fetch.rs | |
parent | b2fa903d64c74d64685397bbf4e98b031371d346 (diff) |
Remove http_client from CliState, store in OpState directly (#7497)
Diffstat (limited to 'cli/ops/fetch.rs')
-rw-r--r-- | cli/ops/fetch.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/cli/ops/fetch.rs b/cli/ops/fetch.rs index 7aece48da..4e4d35d50 100644 --- a/cli/ops/fetch.rs +++ b/cli/ops/fetch.rs @@ -51,9 +51,9 @@ async fn op_fetch( .ok_or_else(bad_resource_id)?; r.client.clone() } else { - let cli_state = super::cli_state2(&state); - let client_ref = cli_state.http_client.borrow(); - client_ref.clone() + let state_ = state.borrow(); + let client = state_.borrow::<reqwest::Client>(); + client.clone() }; let method = match args.method { @@ -103,14 +103,12 @@ async fn op_fetch( ))), ); - let json_res = json!({ + Ok(json!({ "bodyRid": rid, "status": status.as_u16(), "statusText": status.canonical_reason().unwrap_or(""), "headers": res_headers - }); - - Ok(json_res) + })) } struct HttpClientResource { |