Bump js_int, add regression test
The version bump fixes an issue where `UInt`s or `Duration`s in the query string would fail to deserialize
This commit is contained in:
parent
9db26e1dda
commit
0c44e73a78
@ -14,7 +14,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
http = "0.2.1"
|
||||
js_int = { version = "0.1.3", features = ["serde"] }
|
||||
js_int = { version = "0.1.4", features = ["serde"] }
|
||||
ruma-api = "0.15.0"
|
||||
ruma-events = "0.18.0"
|
||||
ruma-identifiers = "0.14.1"
|
||||
|
@ -359,4 +359,32 @@ mod tests {
|
||||
assert!(query.contains("set_presence=offline"));
|
||||
assert!(query.contains("timeout=30000"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deserialize_sync_request_with_query_params() {
|
||||
let uri = http::Uri::builder()
|
||||
.scheme("https")
|
||||
.authority("matrix.org")
|
||||
.path_and_query("/_matrix/client/r0/sync?filter=myfilter&since=myts&full_state=false&set_presence=offline&timeout=5000")
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let req: Request = http::Request::builder()
|
||||
.uri(uri)
|
||||
.body(Vec::<u8>::new())
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
|
||||
match req.filter {
|
||||
Some(Filter::FilterId(id)) if id == "myfilter" => {}
|
||||
_ => {
|
||||
panic!("Not the expected filter ID.");
|
||||
}
|
||||
}
|
||||
assert_eq!(req.since, Some("myts".into()));
|
||||
assert_eq!(req.full_state, false);
|
||||
assert_eq!(req.set_presence, SetPresence::Offline);
|
||||
assert_eq!(req.timeout, Some(Duration::from_millis(5000)));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user