use as_bytes() instead of b

This commit is contained in:
2025-03-20 23:28:15 +01:00
parent 26712c8433
commit bb2e683f20

View File

@ -187,7 +187,8 @@ fn parse_field_lines(
reader.read_line(&mut line).unwrap();
if !line.ends_with("\r\n") {
b"Lines need to end with a CRLF"
"Lines need to end with a CRLF"
.as_bytes()
.iter()
.for_each(|byte| response_body.push(*byte));
@ -212,7 +213,8 @@ fn parse_field_lines(
let field_line = match line.split_once(":") {
Some(val) => val,
None => {
b"Invalid field-line"
"Invalid field-line"
.as_bytes()
.iter()
.for_each(|byte| response_body.push(*byte));
@ -236,7 +238,8 @@ fn parse_field_lines(
}
if !field_lines.contains_key(&String::from("Host")) {
b"field-line with key HOST is missing"
"field-line with key HOST is missing"
.as_bytes()
.iter()
.for_each(|byte| response_body.push(*byte));
@ -372,7 +375,8 @@ fn handle_request(mut stream: TcpStream) -> Result<(), Box<dyn Error>> {
}
if line.ends_with(" ") {
b"There is whitespace between the start-line and the first field-line"
"There is whitespace between the start-line and the first field-line"
.as_bytes()
.iter()
.for_each(|byte| response_body.push(*byte));