@@ -8,7 +8,11 @@ use tide::{Request, Response, Server, StatusCode};
8
8
static COOKIE_NAME : & str = "testCookie" ;
9
9
10
10
async fn retrieve_cookie ( cx : Request < ( ) > ) -> tide:: Result < String > {
11
- Ok ( cx. cookie ( COOKIE_NAME ) . unwrap ( ) . value ( ) . to_string ( ) )
11
+ Ok ( format ! (
12
+ "{} and also {}" ,
13
+ cx. cookie( COOKIE_NAME ) . unwrap( ) . value( ) ,
14
+ cx. cookie( "secondTestCookie" ) . unwrap( ) . value( )
15
+ ) )
12
16
}
13
17
14
18
async fn set_cookie ( _req : Request < ( ) > ) -> tide:: Result {
@@ -47,8 +51,11 @@ fn make_request(endpoint: &str) -> http_types::Response {
47
51
http_types:: Method :: Get ,
48
52
format ! ( "http://example.com{}" , endpoint) . parse ( ) . unwrap ( ) ,
49
53
) ;
50
- req. insert_header ( http_types:: headers:: COOKIE , "testCookie=RequestCookieValue" )
51
- . unwrap ( ) ;
54
+ req. insert_header (
55
+ http_types:: headers:: COOKIE ,
56
+ "testCookie=RequestCookieValue; secondTestCookie=Other%3BCookie%20Value" ,
57
+ )
58
+ . unwrap ( ) ;
52
59
53
60
server. simulate ( req) . unwrap ( )
54
61
}
@@ -61,10 +68,10 @@ fn successfully_retrieve_request_cookie() {
61
68
let body = block_on ( async move {
62
69
let mut buffer = Vec :: new ( ) ;
63
70
res. read_to_end ( & mut buffer) . await . unwrap ( ) ;
64
- buffer
71
+ String :: from_utf8 ( buffer) . unwrap ( )
65
72
} ) ;
66
73
67
- assert_eq ! ( & * body, & * b "RequestCookieValue") ;
74
+ assert_eq ! ( & body, "RequestCookieValue and also Other;Cookie Value " ) ;
68
75
}
69
76
70
77
#[ test]
0 commit comments