client-api: Fix sso_login query param serialization
@@ -17,6 +17,7 @@ ruma_api! {
/// URL to which the homeserver should return the user after completing
/// authentication with the SSO identity provider.
#[ruma_api(query)]
+ #[serde(rename = "redirectUrl")]
pub redirect_url: &'a str,
}
@@ -42,3 +43,22 @@ impl Response {
Self { location }
}
}
+
+#[cfg(test)]
+mod tests {
+ use ruma_api::OutgoingRequest;
+
+ use super::Request;
+
+ #[test]
+ fn serialize_sso_login_request_uri() {
+ let req: http::Request<Vec<u8>> = Request { redirect_url: "https://example.com/sso" }
+ .try_into_http_request("https://homeserver.tld", None)
+ .unwrap();
+
+ assert_eq!(
+ req.uri().to_string(),
+ "https://homeserver.tld/_matrix/client/r0/login/sso/redirect?redirectUrl=https%3A%2F%2Fexample.com%2Fsso"
+ );
+ }
+}
