mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
Remove http_client from CliState, store in OpState directly (#7497)
This commit is contained in:
parent
b2fa903d64
commit
0715803b7f
3 changed files with 11 additions and 12 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue