Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai ce0efc726c fix(mcp): http_run_request sends the request the user approved 2026-11-16 18:29:53 +08:00
2 змінених файлів з 16 додано та 3 видалено

No files matched your search

+5 -2
Переглянути файл
@@ -167,7 +167,10 @@ The `url` field in the result is as written in the file (unsubstituted); transpo
}
call.confirm(&subject, Some(detail)).await?;
let exchange = ide_http::run(input, &call.cancel).await?;
// Exactly the request the user approved: preparing it again would read the
// environment files again, which may name another destination by now.
let redact_url = prepared.url.clone();
let exchange = ide_http::send(prepared, Some(&path), &call.cancel).await?;
let history = call.project().http_history.clone();
let saved = exchange.clone();
let _ = call.host().blocking(move || history.add(&saved)).await;
@@ -188,7 +191,7 @@ The `url` field in the result is as written in the file (unsubstituted); transpo
"status": response.map(|r| r.status),
"statusText": response.map(|r| r.status_text.clone()),
"totalMs": response.map(|r| r.total_ms).or(exchange.entry.total_ms),
"error": redact_transport_error(exchange.entry.error.clone(), &prepared.url),
"error": redact_transport_error(exchange.entry.error.clone(), &redact_url),
"body": body,
"bodyTruncated": body_truncated,
}))
+11 -1
Переглянути файл
@@ -34,6 +34,16 @@ pub struct RunInput<'a> {
/// variables, missing includes) fail; transport errors are part of the exchange.
pub async fn run(input: RunInput<'_>, cancel: &CancellationToken) -> IdeResult<HttpExchange> {
let request = prepare(&input)?;
send(request, input.file, cancel).await
}
/// Sends an already prepared request (one the user approved as shown); `file` is the
/// request file it came from, for the history.
pub async fn send(
request: PreparedRequest,
file: Option<&Path>,
cancel: &CancellationToken,
) -> IdeResult<HttpExchange> {
let time_ms = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_secs_f64() * 1000.0)
@@ -57,7 +67,7 @@ pub async fn run(input: RunInput<'_>, cancel: &CancellationToken) -> IdeResult<H
url: request.url.clone(),
status: response.as_ref().map(|r| r.status),
total_ms: response.as_ref().map(|r| r.total_ms),
file: input.file.map(IpcPath::from),
file: file.map(IpcPath::from),
error,
},
request,