mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 22:49:21 +02:00
upgrade to tokio 0.2
This commit is contained in:
@ -20,19 +20,19 @@ name = "actix_framed"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-codec = "0.2.0-alpha.2"
|
||||
actix-service = "1.0.0-alpha.2"
|
||||
actix-router = "0.1.2"
|
||||
actix-rt = "1.0.0-alpha.2"
|
||||
actix-http = "0.3.0-alpha.2"
|
||||
actix-codec = "0.2.0-alpha.3"
|
||||
actix-service = "1.0.0-alpha.3"
|
||||
actix-router = "0.2.0"
|
||||
actix-rt = "1.0.0-alpha.3"
|
||||
actix-http = "0.3.0-alpha.3"
|
||||
|
||||
bytes = "0.4"
|
||||
bytes = "0.5.2"
|
||||
futures = "0.3.1"
|
||||
pin-project = "0.4.6"
|
||||
log = "0.4"
|
||||
|
||||
[dev-dependencies]
|
||||
actix-server = { version = "1.0.0-alpha.2" }
|
||||
actix-connect = { version = "1.0.0-alpha.2", features=["openssl"] }
|
||||
actix-http-test = { version = "0.3.0-alpha.2", features=["openssl"] }
|
||||
actix-utils = "1.0.0-alpha.2"
|
||||
actix-server = { version = "1.0.0-alpha.3" }
|
||||
actix-connect = { version = "1.0.0-alpha.3", features=["openssl"] }
|
||||
actix-http-test = { version = "0.3.0-alpha.3", features=["openssl"] }
|
||||
actix-utils = "1.0.0-alpha.3"
|
||||
|
@ -123,7 +123,9 @@ impl<Io, S> FramedRequest<Io, S> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use actix_http::http::{HeaderName, HeaderValue, HttpTryFrom};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use actix_http::http::{HeaderName, HeaderValue};
|
||||
use actix_http::test::{TestBuffer, TestRequest};
|
||||
|
||||
use super::*;
|
||||
|
@ -1,10 +1,11 @@
|
||||
//! Various helpers for Actix applications to use during testing.
|
||||
use std::convert::TryFrom;
|
||||
use std::future::Future;
|
||||
|
||||
use actix_codec::Framed;
|
||||
use actix_http::h1::Codec;
|
||||
use actix_http::http::header::{Header, HeaderName, IntoHeaderValue};
|
||||
use actix_http::http::{HttpTryFrom, Method, Uri, Version};
|
||||
use actix_http::http::{Error as HttpError, Method, Uri, Version};
|
||||
use actix_http::test::{TestBuffer, TestRequest as HttpTestRequest};
|
||||
use actix_router::{Path, Url};
|
||||
|
||||
@ -41,7 +42,8 @@ impl TestRequest<()> {
|
||||
/// Create TestRequest and set header
|
||||
pub fn with_header<K, V>(key: K, value: V) -> Self
|
||||
where
|
||||
HeaderName: HttpTryFrom<K>,
|
||||
HeaderName: TryFrom<K>,
|
||||
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
|
||||
V: IntoHeaderValue,
|
||||
{
|
||||
Self::default().header(key, value)
|
||||
@ -96,7 +98,8 @@ impl<S> TestRequest<S> {
|
||||
/// Set a header
|
||||
pub fn header<K, V>(mut self, key: K, value: V) -> Self
|
||||
where
|
||||
HeaderName: HttpTryFrom<K>,
|
||||
HeaderName: TryFrom<K>,
|
||||
<HeaderName as TryFrom<K>>::Error: Into<HttpError>,
|
||||
V: IntoHeaderValue,
|
||||
{
|
||||
self.req.header(key, value);
|
||||
|
@ -3,7 +3,7 @@ use actix_http::{body, http::StatusCode, ws, Error, HttpService, Response};
|
||||
use actix_http_test::TestServer;
|
||||
use actix_service::{pipeline_factory, IntoServiceFactory, ServiceFactory};
|
||||
use actix_utils::framed::FramedTransport;
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use bytes::BytesMut;
|
||||
use futures::{future, SinkExt, StreamExt};
|
||||
|
||||
use actix_framed::{FramedApp, FramedRequest, FramedRoute, SendError, VerifyWebSockets};
|
||||
@ -70,7 +70,7 @@ async fn test_simple() {
|
||||
let (item, mut framed) = framed.into_future().await;
|
||||
assert_eq!(
|
||||
item.unwrap().unwrap(),
|
||||
ws::Frame::Binary(Some(Bytes::from_static(b"text").into()))
|
||||
ws::Frame::Binary(Some(BytesMut::from(&b"text"[..])))
|
||||
);
|
||||
|
||||
framed.send(ws::Message::Ping("text".into())).await.unwrap();
|
||||
@ -136,7 +136,7 @@ async fn test_service() {
|
||||
let (item, mut framed) = framed.into_future().await;
|
||||
assert_eq!(
|
||||
item.unwrap().unwrap(),
|
||||
ws::Frame::Binary(Some(Bytes::from_static(b"text").into()))
|
||||
ws::Frame::Binary(Some(BytesMut::from(&b"text"[..])))
|
||||
);
|
||||
|
||||
framed.send(ws::Message::Ping("text".into())).await.unwrap();
|
||||
|
Reference in New Issue
Block a user