feat: add logging for accept header in http requests
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -213,6 +213,12 @@ pub async fn logging_middleware(
|
||||
let method = request.method().clone();
|
||||
let uri = request.uri().clone();
|
||||
|
||||
// Log the Accept header
|
||||
let accept_header = request.headers()
|
||||
.get("accept")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("-");
|
||||
|
||||
let start = Instant::now();
|
||||
let response = next.run(request).await;
|
||||
let duration = start.elapsed();
|
||||
@@ -224,7 +230,8 @@ pub async fn logging_middleware(
|
||||
.and_then(|s| s.parse::<u64>().ok())
|
||||
.unwrap_or(0);
|
||||
|
||||
info!("{} {} {} {} {} bytes - {:?}", addr, method, uri, response.status(), response_content_length, duration);
|
||||
info!("{} {} {} {} {} bytes - {:?} - Accept: {}",
|
||||
addr, method, uri, response.status(), response_content_length, duration, accept_header);
|
||||
|
||||
response
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user