Send full request to cmd_send_http_request to prevent

update->send race
This commit is contained in:
Gregory Schier
2024-07-28 15:33:12 -07:00
parent 087a1e5ea1
commit fe9f765c1d
2 changed files with 8 additions and 8 deletions

View File

@@ -988,15 +988,14 @@ async fn cmd_save_response(
#[tauri::command]
async fn cmd_send_http_request(
window: WebviewWindow,
request_id: &str,
environment_id: Option<&str>,
cookie_jar_id: Option<&str>,
download_dir: Option<&str>,
// NOTE: We receive the entire request because to account for the race
// condition where the user may have just edited a field before sending
// that has not yet been saved in the DB.
request: HttpRequest,
) -> Result<HttpResponse, String> {
let request = get_http_request(&window, request_id)
.await
.expect("Failed to get request");
let environment = match environment_id {
Some(id) => match get_environment(&window, id).await {
Ok(env) => Some(env),