File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -113,3 +113,28 @@ fn successfully_set_multiple_cookies() {
113
113
114
114
assert ! ( iter. next( ) . is_none( ) ) ;
115
115
}
116
+
117
+ #[ test]
118
+ fn nested_cookies ( ) {
119
+ let mut inner = tide:: new ( ) ;
120
+ inner. at ( "/2" ) . get ( |_req| async move {
121
+ let mut r = Response :: new ( 200 ) ;
122
+ r. set_cookie ( Cookie :: new ( "snack" , "tuna" ) ) ;
123
+ r. body_string ( String :: from ( "ok" ) )
124
+ } ) ;
125
+
126
+ let mut outer = tide:: new ( ) ;
127
+ outer. at ( "/1" ) . nest ( inner) ;
128
+
129
+ let mut server = make_server ( outer. into_http_service ( ) ) . unwrap ( ) ;
130
+
131
+ let req = http:: Request :: get ( "/1/2" )
132
+ . body ( Body :: empty ( ) )
133
+ . unwrap ( ) ;
134
+
135
+ let res = server. simulate ( req) . unwrap ( ) ;
136
+
137
+ let mut cookies = res. headers ( ) . get_all ( http:: header:: SET_COOKIE ) . iter ( ) ;
138
+ assert_eq ! ( cookies. next( ) . unwrap( ) , "snack=tuna" ) ;
139
+ assert ! ( cookies. next( ) . is_none( ) ) ;
140
+ }
You can’t perform that action at this time.
0 commit comments