We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 013401a commit faf2668Copy full SHA for faf2668
src/lib.rs
@@ -674,4 +674,16 @@ mod test {
674
assert!(Url::can_parse("https://google.com", None));
675
assert!(Url::can_parse("/helo", Some("https://www.google.com")));
676
}
677
+
678
+ #[cfg(feature = "serde")]
679
+ #[test]
680
+ fn test_serde_serialize_deserialize() {
681
+ let input = "https://www.google.com";
682
+ let output = "\"https://www.google.com/\"";
683
+ let url = Url::parse(&input, None).unwrap();
684
+ assert_eq!(serde_json::to_string(&url).unwrap(), output.to_string());
685
686
+ let deserialized: Url = serde_json::from_str(&output).unwrap();
687
+ assert_eq!(deserialized.href(), input.to_string() + "/");
688
+ }
689
0 commit comments