From 64360041944638c45f658b9c58b66186127f4344 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 10 Mar 2019 17:06:43 -0700 Subject: [PATCH] set test cookie if it is not empty --- src/test.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test.rs b/src/test.rs index 63ad14994..c60d2d01c 100644 --- a/src/test.rs +++ b/src/test.rs @@ -172,10 +172,12 @@ impl TestRequest { let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET); let _ = write!(&mut cookie, "; {}={}", name, value); } - head.headers.insert( - header::COOKIE, - HeaderValue::from_str(&cookie.as_str()[2..]).unwrap(), - ); + if !cookie.is_empty() { + head.headers.insert( + header::COOKIE, + HeaderValue::from_str(&cookie.as_str()[2..]).unwrap(), + ); + } req }