Skip to content

Commit

Permalink
Fix buffer reading and writing in healthchecker
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoPonzi committed Nov 14, 2024
1 parent 74c4e37 commit b0e3ef9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions horust/src/horust/healthcheck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,13 @@ mod test {
fn handle_request(listener: TcpListener) -> std::io::Result<()> {
if let Some(stream) = listener.incoming().next() {
info!("Received request");
let mut buffer = [0; 512];
let mut buffer = vec![];
let mut stream = stream?;
stream.read(&mut buffer).unwrap();
stream.read_to_end(&mut buffer).unwrap();
let response = b"HTTP/1.1 200 OK\r\n\r\n";
stream.write(response).expect("Stream write");
stream
.write_all(response)
.expect("Failed to send http response back");
}
Ok(())
}
Expand Down

0 comments on commit b0e3ef9

Please sign in to comment.