mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-31 13:39:36 +02:00
feat(http): add request and response tracing behind feature flag (#2079)
This commit is contained in:
@@ -283,6 +283,9 @@ pub async fn fetch<R: Runtime>(
|
||||
|
||||
request = request.headers(headers);
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
tracing::trace!("{:?}", request);
|
||||
|
||||
let fut = async move { request.send().await.map_err(Into::into) };
|
||||
let mut resources_table = webview.resources_table();
|
||||
let rid = resources_table.add_request(Box::pin(fut));
|
||||
@@ -304,6 +307,9 @@ pub async fn fetch<R: Runtime>(
|
||||
.header(header::CONTENT_TYPE, data_url.mime_type().to_string())
|
||||
.body(reqwest::Body::from(body))?;
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
tracing::trace!("{:?}", response);
|
||||
|
||||
let fut = async move { Ok(reqwest::Response::from(response)) };
|
||||
let mut resources_table = webview.resources_table();
|
||||
let rid = resources_table.add_request(Box::pin(fut));
|
||||
@@ -351,6 +357,9 @@ pub async fn fetch_send<R: Runtime>(
|
||||
}
|
||||
};
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
tracing::trace!("{:?}", res);
|
||||
|
||||
let status = res.status();
|
||||
let url = res.url().to_string();
|
||||
let mut headers = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user