Add: verbose flag to show logs in detail
This commit is contained in:
@@ -9,3 +9,4 @@ serde = { version = "1", features = ["derive"] }
|
||||
thiserror = "2"
|
||||
tokio = { version = "1", features = ["net", "time"] }
|
||||
url = "2"
|
||||
tracing = "0.1"
|
||||
|
||||
@@ -4,6 +4,7 @@ use std::net::{IpAddr, SocketAddr};
|
||||
use std::time::{Duration, Instant};
|
||||
use tokio::net::lookup_host;
|
||||
use thiserror::Error;
|
||||
use tracing::debug;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
@@ -67,6 +68,16 @@ pub struct HttpRequestOptions {
|
||||
}
|
||||
|
||||
pub async fn request(url: &str, opts: HttpRequestOptions) -> Result<HttpReport, HttpError> {
|
||||
debug!(
|
||||
url,
|
||||
method = ?opts.method,
|
||||
timeout_ms = opts.timeout_ms,
|
||||
follow_redirects = ?opts.follow_redirects,
|
||||
http1_only = opts.http1_only,
|
||||
http2_only = opts.http2_only,
|
||||
proxy = ?opts.proxy,
|
||||
"http request start"
|
||||
);
|
||||
let parsed = Url::parse(url).map_err(|err| HttpError::Url(err.to_string()))?;
|
||||
let host = parsed
|
||||
.host_str()
|
||||
|
||||
Reference in New Issue
Block a user