1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-08-31 11:26:59 +02:00

Update dependencies (Tokio 1.0) (#144)

This commit is contained in:
Andrey Kutejko
2021-03-21 23:50:26 +01:00
committed by GitHub
parent 86ff1302ad
commit ca85f6b245
34 changed files with 429 additions and 503 deletions

View File

@@ -91,8 +91,8 @@ impl<S: Scheme> Header for Authorization<S> {
impl<S: Scheme> IntoHeaderValue for Authorization<S> {
type Error = <S as IntoHeaderValue>::Error;
fn try_into(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
self.0.try_into()
fn try_into_value(self) -> Result<HeaderValue, Self::Error> {
self.0.try_into_value()
}
}

View File

@@ -97,7 +97,7 @@ impl fmt::Display for Basic {
impl IntoHeaderValue for Basic {
type Error = InvalidHeaderValue;
fn try_into(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
fn try_into_value(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
let mut credentials = BytesMut::with_capacity(
self.user_id.len()
+ 1 // ':'
@@ -187,7 +187,7 @@ mod tests {
password: Some("open sesame".into()),
};
let result = basic.try_into();
let result = basic.try_into_value();
assert!(result.is_ok());
assert_eq!(
result.unwrap(),

View File

@@ -76,7 +76,7 @@ impl fmt::Display for Bearer {
impl IntoHeaderValue for Bearer {
type Error = InvalidHeaderValue;
fn try_into(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
fn try_into_value(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
let mut buffer = BytesMut::with_capacity(7 + self.token.len());
buffer.put(&b"Bearer "[..]);
buffer.extend_from_slice(self.token.as_bytes());
@@ -128,7 +128,7 @@ mod tests {
fn test_into_header_value() {
let bearer = Bearer::new("mF_9.B5f-4.1JqM");
let result = bearer.try_into();
let result = bearer.try_into_value();
assert!(result.is_ok());
assert_eq!(
result.unwrap(),

View File

@@ -25,7 +25,7 @@ use crate::utils;
/// let challenge = Basic::with_realm("Restricted area");
///
/// HttpResponse::Unauthorized()
/// .set(WwwAuthenticate(challenge))
/// .insert_header(WwwAuthenticate(challenge))
/// .finish()
/// }
/// ```
@@ -106,7 +106,7 @@ impl fmt::Display for Basic {
impl IntoHeaderValue for Basic {
type Error = InvalidHeaderValue;
fn try_into(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
fn try_into_value(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
HeaderValue::from_maybe_shared(self.to_bytes())
}
}
@@ -120,7 +120,7 @@ mod tests {
fn test_plain_into_header_value() {
let challenge = Basic { realm: None };
let value = challenge.try_into();
let value = challenge.try_into_value();
assert!(value.is_ok());
let value = value.unwrap();
assert_eq!(value, "Basic");
@@ -132,7 +132,7 @@ mod tests {
realm: Some("Restricted area".into()),
};
let value = challenge.try_into();
let value = challenge.try_into_value();
assert!(value.is_ok());
let value = value.unwrap();
assert_eq!(value, "Basic realm=\"Restricted area\"");

View File

@@ -31,7 +31,7 @@ use crate::utils;
/// .finish();
///
/// HttpResponse::Unauthorized()
/// .set(WwwAuthenticate(challenge))
/// .insert_header(WwwAuthenticate(challenge))
/// .finish()
/// }
/// ```
@@ -133,7 +133,7 @@ impl fmt::Display for Bearer {
impl IntoHeaderValue for Bearer {
type Error = InvalidHeaderValue;
fn try_into(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
fn try_into_value(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
HeaderValue::from_maybe_shared(self.to_bytes())
}
}

View File

@@ -27,7 +27,7 @@ impl<C: Challenge> Header for WwwAuthenticate<C> {
impl<C: Challenge> IntoHeaderValue for WwwAuthenticate<C> {
type Error = <C as IntoHeaderValue>::Error;
fn try_into(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
self.0.try_into()
fn try_into_value(self) -> Result<HeaderValue, <Self as IntoHeaderValue>::Error> {
self.0.try_into_value()
}
}