Remove superfluous status check

This commit is contained in:
Roderick van Domburg 2021-06-20 20:45:15 +02:00
parent e1e265179f
commit ce4f8dc288
No known key found for this signature in database
GPG key ID: 7076AA781B43EFE6

View file

@ -78,20 +78,15 @@ impl TokenProvider {
); );
let request = self.session().mercury().get(query_uri); let request = self.session().mercury().get(query_uri);
let response = request.await?; let response = request.await?;
let data = response
if response.status_code == 200 { .payload
let data = response .first()
.payload .expect("No tokens received")
.first() .to_vec();
.expect("No tokens received") let token = Token::new(String::from_utf8(data).unwrap()).map_err(|_| MercuryError)?;
.to_vec(); trace!("Got token: {:?}", token);
let token = Token::new(String::from_utf8(data).unwrap()).map_err(|_| MercuryError)?; self.lock(|inner| inner.tokens.push(token.clone()));
trace!("Got token: {:?}", token); Ok(token)
self.lock(|inner| inner.tokens.push(token.clone()));
Ok(token)
} else {
Err(MercuryError)
}
} }
} }