mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 06:57:43 +02:00
body ergonomics v3 (#2468)
This commit is contained in:
@ -22,7 +22,7 @@ actix-web = { version = "4.0.0-beta.11", default-features = false }
|
||||
bytes = "1"
|
||||
bytestring = "1"
|
||||
futures-core = { version = "0.3.7", default-features = false }
|
||||
pin-project = "1.0.0"
|
||||
pin-project-lite = "0.2"
|
||||
tokio = { version = "1", features = ["sync"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -30,6 +30,7 @@ use actix_web::{
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use bytestring::ByteString;
|
||||
use futures_core::Stream;
|
||||
use pin_project_lite::pin_project;
|
||||
use tokio::sync::oneshot::Sender;
|
||||
|
||||
/// Perform WebSocket handshake and start actor.
|
||||
@ -462,13 +463,14 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[pin_project::pin_project]
|
||||
struct WsStream<S> {
|
||||
#[pin]
|
||||
stream: S,
|
||||
decoder: Codec,
|
||||
buf: BytesMut,
|
||||
closed: bool,
|
||||
pin_project! {
|
||||
struct WsStream<S> {
|
||||
#[pin]
|
||||
stream: S,
|
||||
decoder: Codec,
|
||||
buf: BytesMut,
|
||||
closed: bool,
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> WsStream<S>
|
||||
|
@ -78,7 +78,7 @@ async fn test_with_credentials() {
|
||||
match srv.ws().await {
|
||||
Ok(_) => panic!("WebSocket client without credentials should panic"),
|
||||
Err(awc::error::WsClientError::InvalidResponseStatus(status)) => {
|
||||
assert_eq!(status, StatusCode::UNAUTHORIZED)
|
||||
assert_eq!(status, StatusCode::UNAUTHORIZED);
|
||||
}
|
||||
Err(e) => panic!("Invalid error from WebSocket client: {}", e),
|
||||
}
|
||||
|
Reference in New Issue
Block a user