1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

add connection level data container (#2491)

This commit is contained in:
Rob Ede
2021-12-07 17:23:34 +00:00
committed by GitHub
parent 069cf2da07
commit d35b7644dc
18 changed files with 152 additions and 125 deletions

View File

@ -8,7 +8,7 @@ use actix_http::{
body::{BodyStream, BoxBody, SizedStream},
error::PayloadError,
header::{self, HeaderValue},
Error, HttpMessage, HttpService, Method, Request, Response, StatusCode, Version,
Error, HttpService, Method, Request, Response, StatusCode, Version,
};
use actix_http_test::test_server;
use actix_service::{fn_service, ServiceFactoryExt};
@ -430,7 +430,7 @@ async fn test_h2_on_connect() {
data.insert(20isize);
})
.h2(|req: Request| {
assert!(req.extensions().contains::<isize>());
assert!(req.conn_data::<isize>().is_some());
ok::<_, Infallible>(Response::ok())
})
.openssl(tls_config())

View File

@ -7,7 +7,7 @@ use std::{
use actix_http::{
body::{self, BodyStream, BoxBody, SizedStream},
header, Error, HttpMessage, HttpService, KeepAlive, Request, Response, StatusCode,
header, Error, HttpService, KeepAlive, Request, Response, StatusCode,
};
use actix_http_test::test_server;
use actix_rt::time::sleep;
@ -748,7 +748,7 @@ async fn test_h1_on_connect() {
data.insert(20isize);
})
.h1(|req: Request| {
assert!(req.extensions().contains::<isize>());
assert!(req.conn_data::<isize>().is_some());
ok::<_, Infallible>(Response::ok())
})
.tcp()