Created
January 12, 2020 15:27
-
-
Save kuy/bb8b528dca478cf7ae301ba4012aeb6c to your computer and use it in GitHub Desktop.
actix-web + serde_urlencoded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- deserialize_option stdout ---- | |
thread 'deserialize_option' panicked at 'assertion failed: `(left == right)` | |
left: `Ok([("last", Some(42))])`, | |
right: `Ok([("first", None), ("last", Some(42))])`', tests/test_deserialize.rs:59:5 | |
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thread 'deserialize_option' panicked at 'assertion failed: `(left == right)` | |
left: `Err(Error { err: "cannot parse integer from empty string" })`, | |
right: `Ok([("first", None), ("last", Some(42))])`', tests/test_deserialize.rs:59:5 | |
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[test] | |
fn deserialize_option() { | |
// Original | |
let result = vec![ | |
("first".to_owned(), Some(23)), | |
("last".to_owned(), Some(42)), | |
]; | |
assert_eq!(serde_urlencoded::from_str("first=23&last=42"), Ok(result)); | |
// Added by me | |
let result = | |
vec![("first".to_owned(), None), ("last".to_owned(), Some(42))]; | |
assert_eq!(serde_urlencoded::from_str("last=42"), Ok(result)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[test] | |
fn deserialize_option() { | |
// Original | |
let result = vec![ | |
("first".to_owned(), Some(23)), | |
("last".to_owned(), Some(42)), | |
]; | |
assert_eq!(serde_urlencoded::from_str("first=23&last=42"), Ok(result)); | |
// Added by me | |
let result = | |
vec![("first".to_owned(), None), ("last".to_owned(), Some(42))]; | |
assert_eq!(serde_urlencoded::from_str("first=&last=42"), Ok(result)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment