mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-01-05 10:50:36 +01:00
fix(common): AuthenticationType implements Str
Instead of an arbitrary `url()` method with the signature of `to_slice()`
This commit is contained in:
@@ -23,9 +23,9 @@ pub enum AuthenticationType {
|
||||
Device,
|
||||
}
|
||||
|
||||
impl AuthenticationType {
|
||||
impl Str for AuthenticationType {
|
||||
/// Converts itself into a URL string
|
||||
pub fn url(&self) -> &'static str {
|
||||
fn as_slice(&self) -> &'static str {
|
||||
match *self {
|
||||
AuthenticationType::Device => "https://accounts.google.com/o/oauth2/device/code",
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ impl<NC> DeviceFlow<NC>
|
||||
.collect::<String>()
|
||||
.as_slice())].iter().cloned());
|
||||
|
||||
match self.client.post(AuthenticationType::Device.url())
|
||||
match self.client.post(AuthenticationType::Device.as_slice())
|
||||
.header(ContentType("application/x-www-form-urlencoded".parse().unwrap()))
|
||||
.body(req.as_slice())
|
||||
.send() {
|
||||
|
||||
@@ -68,7 +68,7 @@ impl<NC> RefreshFlow<NC>
|
||||
.iter().cloned());
|
||||
|
||||
let json_str =
|
||||
match self.client.post(auth_type.url())
|
||||
match self.client.post(auth_type.as_slice())
|
||||
.header(ContentType("application/x-www-form-urlencoded".parse().unwrap()))
|
||||
.body(req.as_slice())
|
||||
.send() {
|
||||
|
||||
Reference in New Issue
Block a user