aboutsummaryrefslogtreecommitdiffhomepage
path: root/pingora-header-serde
diff options
context:
space:
mode:
authorKevin Guthrie <[email protected]>2024-09-26 16:49:09 -0400
committerYuchen Wu <[email protected]>2024-10-11 15:40:59 -0700
commit289687928a0bea04df31f76db783548b62cd8af6 (patch)
tree52982d9d8bd7e33cccaaf098c6596eb70f826470 /pingora-header-serde
parent4bc741c4f5d2029c66697ffc243d2b5dee3d213b (diff)
downloadpingora-289687928a0bea04df31f76db783548b62cd8af6.tar.gz
pingora-289687928a0bea04df31f76db783548b62cd8af6.zip
Add a warning log if the dictionary for `HeaderSerde` is `None`
Diffstat (limited to 'pingora-header-serde')
-rw-r--r--pingora-header-serde/src/dict.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/pingora-header-serde/src/dict.rs b/pingora-header-serde/src/dict.rs
index bc50ada..71a85b6 100644
--- a/pingora-header-serde/src/dict.rs
+++ b/pingora-header-serde/src/dict.rs
@@ -74,6 +74,23 @@ mod test {
}
#[test]
+ fn test_deserialize_with_dict() {
+ let dict = gen_test_dict();
+ let serde = crate::HeaderSerde::new(Some(dict));
+ let serde_no_dict = crate::HeaderSerde::new(None);
+ let header = gen_test_header();
+
+ let compressed = serde.serialize(&header).unwrap();
+ let compressed_no_dict = serde_no_dict.serialize(&header).unwrap();
+
+ let from_dict_header = serde.deserialize(&compressed).unwrap();
+ let from_no_dict_header = serde_no_dict.deserialize(&compressed_no_dict).unwrap();
+
+ assert_eq!(from_dict_header.status, from_no_dict_header.status);
+ assert_eq!(from_dict_header.headers, from_no_dict_header.headers);
+ }
+
+ #[test]
fn test_ser_de_with_dict() {
let dict = gen_test_dict();
let serde = crate::HeaderSerde::new(Some(dict));