fix(types::Token): Don't panic if refresh_token is empty

Service account tokens don't set the refresh_token. Checking the
access_token field should be sufficient.
This commit is contained in:
Lewin Bormann
2016-09-21 09:24:09 +02:00
parent 943f57e42f
commit ed0a3c4990

View File

@@ -200,7 +200,7 @@ impl Token {
/// # Panics
/// * if our access_token is unset
pub fn expired(&self) -> bool {
if self.access_token.len() == 0 || self.refresh_token.len() == 0 {
if self.access_token.len() == 0 {
panic!("called expired() on unset token");
}
self.expiry_date() <= UTC::now()