Remove http_client from CliState, store in OpState directly (#7497)

This commit is contained in:
Ryan Dahl 2020-09-15 16:15:01 -04:00 committed by GitHub
parent b2fa903d64
commit 0715803b7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 12 deletions

View file

@ -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 {