Skip to content

Commit 98dbeb0

Browse files
committed
spclient: improve token request logging
1 parent ccccd7b commit 98dbeb0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

core/src/spclient.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ impl SpClient {
270270
match ClientTokenResponseType::from_i32(message.response_type.value()) {
271271
// depending on the platform, you're either given a token immediately
272272
// or are presented a hash cash challenge to solve first
273-
Some(ClientTokenResponseType::RESPONSE_GRANTED_TOKEN_RESPONSE) => break message,
273+
Some(ClientTokenResponseType::RESPONSE_GRANTED_TOKEN_RESPONSE) => {
274+
debug!("Received a granted token");
275+
break message
276+
}
274277
Some(ClientTokenResponseType::RESPONSE_CHALLENGES_RESPONSE) => {
275278
debug!("Received a hash cash challenge, solving...");
276279

@@ -479,11 +482,14 @@ impl SpClient {
479482
HeaderValue::from_str(&format!("{} {}", token.token_type, token.access_token,))?,
480483
);
481484

482-
if let Ok(client_token) = self.client_token().await {
483-
headers_mut.insert(CLIENT_TOKEN, HeaderValue::from_str(&client_token)?);
484-
} else {
485-
// currently these endpoints seem to work fine without it
486-
warn!("Unable to get client token. Trying to continue without...");
485+
match self.client_token().await {
486+
Ok(client_token) => {
487+
let _ = headers_mut.insert(CLIENT_TOKEN, HeaderValue::from_str(&client_token)?);
488+
}
489+
Err(e) => {
490+
// currently these endpoints seem to work fine without it
491+
warn!("Unable to get client token: {e} Trying to continue without...")
492+
}
487493
}
488494

489495
last_response = self.session().http_client().request_body(request).await;

0 commit comments

Comments
 (0)