mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-02-23 15:50:00 +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,
|
Device,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AuthenticationType {
|
impl Str for AuthenticationType {
|
||||||
/// Converts itself into a URL string
|
/// Converts itself into a URL string
|
||||||
pub fn url(&self) -> &'static str {
|
fn as_slice(&self) -> &'static str {
|
||||||
match *self {
|
match *self {
|
||||||
AuthenticationType::Device => "https://accounts.google.com/o/oauth2/device/code",
|
AuthenticationType::Device => "https://accounts.google.com/o/oauth2/device/code",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ impl<NC> DeviceFlow<NC>
|
|||||||
.collect::<String>()
|
.collect::<String>()
|
||||||
.as_slice())].iter().cloned());
|
.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()))
|
.header(ContentType("application/x-www-form-urlencoded".parse().unwrap()))
|
||||||
.body(req.as_slice())
|
.body(req.as_slice())
|
||||||
.send() {
|
.send() {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ impl<NC> RefreshFlow<NC>
|
|||||||
.iter().cloned());
|
.iter().cloned());
|
||||||
|
|
||||||
let json_str =
|
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()))
|
.header(ContentType("application/x-www-form-urlencoded".parse().unwrap()))
|
||||||
.body(req.as_slice())
|
.body(req.as_slice())
|
||||||
.send() {
|
.send() {
|
||||||
|
|||||||
Reference in New Issue
Block a user