1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 07:53:00 +01:00

export ws::hash_key

This commit is contained in:
Nikolay Kim 2019-03-17 21:09:50 -07:00
parent 2b5f9f0511
commit 85c2887b30
3 changed files with 2 additions and 45 deletions

View File

@ -981,23 +981,6 @@ mod tests {
from!(httparse::Error::Version => ParseError::Version);
}
// #[test]
// fn failure_error() {
// const NAME: &str = "RUST_BACKTRACE";
// let old_tb = env::var(NAME);
// env::set_var(NAME, "0");
// let error = failure::err_msg("Hello!");
// let resp: Error = error.into();
// assert_eq!(
// format!("{:?}", resp),
// "Compat { error: ErrorMessage { msg: \"Hello!\" } }\n\n"
// );
// match old_tb {
// Ok(x) => env::set_var(NAME, x),
// _ => env::remove_var(NAME),
// }
// }
#[test]
fn test_internal_error() {
let err =
@ -1006,32 +989,6 @@ mod tests {
assert_eq!(resp.status(), StatusCode::OK);
}
// #[test]
// fn test_error_downcasting_direct() {
// #[derive(Debug, Display)]
// #[display(fmt = "demo error")]
// struct DemoError;
// impl ResponseError for DemoError {}
// let err: Error = DemoError.into();
// let err_ref: &DemoError = err.downcast_ref().unwrap();
// assert_eq!(err_ref.to_string(), "demo error");
// }
// #[test]
// fn test_error_downcasting_compat() {
// #[derive(Debug, Display)]
// #[display(fmt = "demo error")]
// struct DemoError;
// impl ResponseError for DemoError {}
// let err: Error = failure::Error::from(DemoError).into();
// let err_ref: &DemoError = err.downcast_ref().unwrap();
// assert_eq!(err_ref.to_string(), "demo error");
// }
#[test]
fn test_error_helpers() {
let r: Response = ErrorBadRequest("err").into();

View File

@ -24,7 +24,7 @@ mod transport;
pub use self::client::{Client, ClientError, Connect};
pub use self::codec::{Codec, Frame, Message};
pub use self::frame::Parser;
pub use self::proto::{CloseCode, CloseReason, OpCode};
pub use self::proto::{hash_key, CloseCode, CloseReason, OpCode};
pub use self::service::VerifyWebSockets;
pub use self::transport::Transport;

View File

@ -209,7 +209,7 @@ impl<T: Into<String>> From<(CloseCode, T)> for CloseReason {
static WS_GUID: &'static str = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
// TODO: hash is always same size, we dont need String
pub(crate) fn hash_key(key: &[u8]) -> String {
pub fn hash_key(key: &[u8]) -> String {
let mut hasher = sha1::Sha1::new();
hasher.update(key);