mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-22 15:52:24 +02:00
refactored unwrap calls to make it more stable
This commit is contained in:
@@ -7,7 +7,10 @@ use shared::utils::{filter_response_header};
|
||||
pub fn get_response_headers(headers: &HeaderMap) -> Vec<(String, String)> {
|
||||
let mut response_headers: Vec<(String, String)> = headers.iter()
|
||||
.filter(|(key, _)| filter_response_header(key.as_str()))
|
||||
.map(|(key, value)| (key.to_string(), value.to_str().unwrap().to_string())).collect();
|
||||
.filter_map(|(key, value)| {
|
||||
value.to_str().ok().map(|v| (key.to_string(), v.to_string()))
|
||||
})
|
||||
.collect();
|
||||
response_headers.push((axum::http::header::CONNECTION.as_str().to_string(), "keep-alive".to_string()));
|
||||
response_headers
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user