1use actix_web::{HttpResponse, Responder, http::header::ContentType, web};
4
5use crate::taskserver::Control;
6
7#[actix_web::get("/tmp/{id}")]
8async fn index_get(ctrl: web::Data<Control>, path: web::Path<String>) -> impl Responder {
9 let id = path.into_inner();
10
11 {
12 let http = ctrl.sysmods().http.lock().await;
13 if let Some(elem) = http.tmp_data.iter().find(|elem| elem.id == id) {
14 return HttpResponse::Ok()
15 .content_type(elem.ctype.clone())
16 .body(elem.data.clone());
17 }
18 }
19
20 HttpResponse::NotFound()
21 .content_type(ContentType::plaintext())
22 .body(id)
23}