pub fn handshake(req: &Request) -> HandshakeExpand description
Read the handshake headers and compute the answer.
use majordomus_cli::http::{ws::{handshake, Handshake}, Request};
// the example key of RFC 6455 ยง1.3 and the accept value it specifies
let req = Request::parse_target("GET", "/events", vec![]).with_headers(vec![
("Upgrade".into(), "websocket".into()),
("Connection".into(), "Upgrade".into()),
("Sec-WebSocket-Key".into(), "dGhlIHNhbXBsZSBub25jZQ==".into()),
("Sec-WebSocket-Version".into(), "13".into()),
]);
assert_eq!(
handshake(&req),
Handshake::Accept("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=".into())
);