appservice-api: Make the url field of Registration an Option
It was always possible to set it to `null`, according to the Matrix spec.
This commit is contained in:
parent
7c49b84e6d
commit
9a5142052c
@ -1,5 +1,10 @@
|
||||
# [unreleased]
|
||||
|
||||
Breaking changes:
|
||||
|
||||
* The `url` field of `Registration` is now an `Option<String>`. This should have
|
||||
always been the case.
|
||||
|
||||
# 0.9.0
|
||||
|
||||
Improvements:
|
||||
|
@ -74,7 +74,9 @@ pub struct Registration {
|
||||
pub id: String,
|
||||
|
||||
/// The URL for the application service.
|
||||
pub url: String,
|
||||
///
|
||||
/// Optionally set to `null` if no traffic is required.
|
||||
pub url: Option<String>,
|
||||
|
||||
/// A unique token for application services to use to authenticate requests to Homeservers.
|
||||
pub as_token: String,
|
||||
@ -112,7 +114,9 @@ pub struct RegistrationInit {
|
||||
pub id: String,
|
||||
|
||||
/// The URL for the application service.
|
||||
pub url: String,
|
||||
///
|
||||
/// Optionally set to `null` if no traffic is required.
|
||||
pub url: Option<String>,
|
||||
|
||||
/// A unique token for application services to use to authenticate requests to Homeservers.
|
||||
pub as_token: String,
|
||||
|
@ -21,7 +21,7 @@ fn registration_deserialization() {
|
||||
let observed: Registration = serde_yaml::from_str(registration_config).unwrap();
|
||||
|
||||
assert_eq!(observed.id, "IRC Bridge");
|
||||
assert_eq!(observed.url, "http://127.0.0.1:1234");
|
||||
assert_eq!(observed.url.unwrap(), "http://127.0.0.1:1234");
|
||||
assert_eq!(
|
||||
observed.as_token,
|
||||
"30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46"
|
||||
@ -59,5 +59,5 @@ fn config_with_optional_url() {
|
||||
rooms: []
|
||||
"#;
|
||||
assert_matches!(serde_yaml::from_str(registration_config).unwrap(), Registration { url, .. });
|
||||
assert_eq!(url, "null");
|
||||
assert_eq!(url, None);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user