Made request pass session to message.
This commit is contained in:
26
src/main.rs
26
src/main.rs
@ -67,7 +67,7 @@ mod servers {
|
||||
body::Body,
|
||||
http::{Request, StatusCode},
|
||||
};
|
||||
use tower::ServiceExt;
|
||||
use tower::{Service, ServiceExt};
|
||||
|
||||
#[tokio::test]
|
||||
async fn get_home_page() {
|
||||
@ -100,4 +100,28 @@ mod servers {
|
||||
holder.push(sessid);
|
||||
}
|
||||
}
|
||||
|
||||
// Next test to complete.
|
||||
//#[tokio::test]
|
||||
async fn session_only_sent_once() {
|
||||
let mut app = mtt_conn.with_state(MoreThanText::new());
|
||||
let request = Request::builder().uri("/").body(Body::empty()).unwrap();
|
||||
let response = ServiceExt::<Request<Body>>::ready(&mut app)
|
||||
.await
|
||||
.unwrap()
|
||||
.call(request)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
let request = Request::builder().uri("/").body(Body::empty()).unwrap();
|
||||
let response = ServiceExt::<Request<Body>>::ready(&mut app)
|
||||
.await
|
||||
.unwrap()
|
||||
.call(request)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
let session = response.headers().get("set-cookie");
|
||||
assert!(session.is_none(), "should only send the session once");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user