1pub struct RawHttpResponse;
2
3impl RawHttpResponse {
4 pub fn build(status_line: &str, headers: &[(&str, &str)], body: &[u8]) -> Vec<u8> {
5 let mut out = Vec::new();
6 out.extend_from_slice(status_line.as_bytes());
7 out.extend_from_slice(b"\r\n");
8 for (name, value) in headers {
9 out.extend_from_slice(name.as_bytes());
10 out.extend_from_slice(b": ");
11 out.extend_from_slice(value.as_bytes());
12 out.extend_from_slice(b"\r\n");
13 }
14 out.extend_from_slice(b"\r\n");
15 out.extend_from_slice(body);
16 out
17 }
18}