/// Check that a handshake request has the correct session ID value.
Check that a handshake request has the correct session ID value.
Check that a handshake request has the correct session ID value .
pub fn validate_request(req: &Request, expected_id: Option<&str>) -> ws::Result<ws::Response> {
    match (expected_id, req.header(SESSION_ID_HEADER)) {
        (Some(exp), Some(obs)) if &obs[..] == exp.as_bytes() => ws::Response::from_request(req),
        (None, _) => ws::Response::from_request(req),
        _ => Err(ws::Error::new(ws::ErrorKind::Internal, "Invalid SessionId")),
    }
}
pub fn validate_request ( req : & Request , expected_id : Option < & str > ) -> ws :: Result < ws :: Response > { match ( expected_id , req . header ( SESSION_ID_HEADER ) ) { ( Some ( exp ) , Some ( obs ) ) if & obs [ .. ] == exp . as_bytes ( ) => ws :: Response :: from_request ( req ) , ( None , _ ) => ws :: Response :: from_request ( req ) , _ => Err ( ws :: Error :: new ( ws :: ErrorKind :: Internal , " " ) ) , } }
Check that a handshake request has the correct session ID value.
Check that a handshake request has the correct session ID value .
req
&Request
expected_id
Option<&str>