fix: Fixed the logout method that got a 504 from API due to wrong usage
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
53ddc549c1
commit
6225d26333
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "livebox"
|
||||
version = "0.9.2"
|
||||
version = "0.9.3"
|
||||
edition = "2021"
|
||||
description = "A library to gather data from Livebox 4 & 5."
|
||||
license = "GPL-3.0"
|
||||
|
@ -186,13 +186,19 @@ impl Client {
|
||||
/// Logout from the router.
|
||||
pub async fn logout(&mut self) {
|
||||
trace!("Logging out.");
|
||||
let post_data = json!({
|
||||
"service":"sah.Device.Information",
|
||||
"method":"releaseContext",
|
||||
"parameters":{"applicationName":"so_sdkut"}}
|
||||
);
|
||||
let req = Request::builder()
|
||||
.method(Method::POST)
|
||||
.uri(format!("http://{}/ws", self.ip))
|
||||
.header(AUTHORIZATION,
|
||||
format!("X-Sah-Logout {}", self.context_id.clone().unwrap()))
|
||||
.header(COOKIE, self.cookies.join("; "))
|
||||
.body(Body::empty())
|
||||
.body(Body::from(post_data.to_string()))
|
||||
.expect("Could not build request.");
|
||||
|
||||
self.client.request(req).await
|
||||
.expect("There was an issue contacting the router.");
|
||||
debug!("Logged out.");
|
||||
|
Loading…
Reference in New Issue
Block a user