mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
spclient: improve token request logging
This commit is contained in:
parent
ba314b63e4
commit
29f3345030
1 changed files with 12 additions and 6 deletions
|
@ -270,7 +270,10 @@ impl SpClient {
|
||||||
match ClientTokenResponseType::from_i32(message.response_type.value()) {
|
match ClientTokenResponseType::from_i32(message.response_type.value()) {
|
||||||
// depending on the platform, you're either given a token immediately
|
// depending on the platform, you're either given a token immediately
|
||||||
// or are presented a hash cash challenge to solve first
|
// or are presented a hash cash challenge to solve first
|
||||||
Some(ClientTokenResponseType::RESPONSE_GRANTED_TOKEN_RESPONSE) => break message,
|
Some(ClientTokenResponseType::RESPONSE_GRANTED_TOKEN_RESPONSE) => {
|
||||||
|
debug!("Received a granted token");
|
||||||
|
break message;
|
||||||
|
}
|
||||||
Some(ClientTokenResponseType::RESPONSE_CHALLENGES_RESPONSE) => {
|
Some(ClientTokenResponseType::RESPONSE_CHALLENGES_RESPONSE) => {
|
||||||
debug!("Received a hash cash challenge, solving...");
|
debug!("Received a hash cash challenge, solving...");
|
||||||
|
|
||||||
|
@ -480,11 +483,14 @@ impl SpClient {
|
||||||
HeaderValue::from_str(&format!("{} {}", token.token_type, token.access_token,))?,
|
HeaderValue::from_str(&format!("{} {}", token.token_type, token.access_token,))?,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Ok(client_token) = self.client_token().await {
|
match self.client_token().await {
|
||||||
headers_mut.insert(CLIENT_TOKEN, HeaderValue::from_str(&client_token)?);
|
Ok(client_token) => {
|
||||||
} else {
|
let _ = headers_mut.insert(CLIENT_TOKEN, HeaderValue::from_str(&client_token)?);
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
// currently these endpoints seem to work fine without it
|
// currently these endpoints seem to work fine without it
|
||||||
warn!("Unable to get client token. Trying to continue without...");
|
warn!("Unable to get client token: {e} Trying to continue without...")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
last_response = self.session().http_client().request_body(request).await;
|
last_response = self.session().http_client().request_body(request).await;
|
||||||
|
|
Loading…
Reference in a new issue