webchaussette 1.3.3

Fast, powerful, and easy-to-set-up WebSocket library
Documentation
1
2
3
4
5
6
7
8
9
10
use crate::websocket_types::ResponseStruct;

pub fn build_response(data: ResponseStruct) -> String {
    let mut response_string: String = format!("{}\r\n", data.status.as_str());
    for (key, value) in data.headers {
        response_string.push_str(&format!("{}: {}\r\n", key, value));
    }
    response_string.push_str("\r\n");
    response_string
}