Documente la crate pmoapp

This commit is contained in:
2025-10-06 11:54:32 +02:00
parent abcf4ebaf9
commit adb316a6ac
5 changed files with 229 additions and 29 deletions

View File

@@ -316,10 +316,7 @@ impl DeviceInstance {
return StatusCode::INTERNAL_SERVER_ERROR.into_response();
}
let mut xml = String::from_utf8_lossy(&xml_output).to_string();
// Ajouter l'en-tête XML
xml.insert_str(0, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
let xml = String::from_utf8_lossy(&xml_output).to_string();
(
StatusCode::OK,

View File

@@ -112,10 +112,7 @@ pub trait UpnpObject: Clone + Debug {
elem.write_with_config(&mut buf, config)
.expect("Failed to write XML");
let mut xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".to_string();
xml_string.push_str(&String::from_utf8(buf).expect("Invalid UTF-8"));
xml_string
String::from_utf8(buf).expect("Invalid UTF-8")
}
/// Convertit l'objet en représentation Markdown.

View File

@@ -447,10 +447,7 @@ impl Service {
elem.write_with_config(&mut buf, config)
.expect("Failed to write XML");
let mut xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".to_string();
xml_string.push_str(&String::from_utf8(buf).expect("Invalid UTF-8"));
xml_string
String::from_utf8(buf).expect("Invalid UTF-8")
}
}

View File

@@ -395,11 +395,8 @@ impl ServiceInstance {
return StatusCode::INTERNAL_SERVER_ERROR.into_response();
}
let mut xml = String::from_utf8_lossy(&xml_output).to_string();
// Ajouter l'en-tête XML
xml.insert_str(0, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
let xml = String::from_utf8_lossy(&xml_output).to_string();
(
StatusCode::OK,
[(axum::http::header::CONTENT_TYPE, "text/xml; charset=\"utf-8\"")],