diff --git a/src/printer.rs b/src/printer.rs index 515ef950..c83776a4 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -336,8 +336,8 @@ impl Printer { header_string.push_str(key.as_str()); } header_string.push_str(": "); - match value.to_str() { - Ok(value) => header_string.push_str(value), + match String::from_utf8(value.as_bytes().to_vec()) { + Ok(value) => header_string.push_str(&value), #[allow(clippy::format_push_string)] Err(_) => header_string.push_str(&format!("{:?}", value)), } diff --git a/src/redirect.rs b/src/redirect.rs index 202fef3a..1d0ed924 100644 --- a/src/redirect.rs +++ b/src/redirect.rs @@ -51,8 +51,8 @@ fn get_next_request(mut request: Request, response: &Response) -> Option Result { if value.is_empty() { cmd.arg(format!("{};", header)); } else { - cmd.arg(format!("{}: {}", header, value.to_str()?)); + cmd.arg(format!( + "{}: {}", + header, + String::from_utf8(value.as_bytes().to_vec())? + )); } } for header in headers_to_unset {