(response: &[u8])
| 585 | } |
| 586 | |
| 587 | fn split_http_response(response: &[u8]) -> Option<(String, &[u8])> { |
| 588 | let separator = response |
| 589 | .windows(4) |
| 590 | .position(|window| window == b"\r\n\r\n")?; |
| 591 | let headers = String::from_utf8_lossy(&response[..separator]).into_owned(); |
| 592 | Some((headers, &response[separator + 4..])) |
| 593 | } |
| 594 | |
| 595 | fn response_has_complete_body(response: &[u8]) -> bool { |
| 596 | let Some((headers, body)) = split_http_response(response) else { |
no test coverage detected