You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-21 23:00:50 +03:00
Apply suggestions from code review
Co-authored-by: Kévin Commaille <76261501+zecakeh@users.noreply.github.com>
This commit is contained in:
@@ -38,4 +38,4 @@ tower = { version = "0.4.13", features = ["util"] }
|
||||
[features]
|
||||
default = []
|
||||
axum = ["dep:axum"]
|
||||
client = ["dep:hyper-rustls", "hyper/tcp", "tokio", "tokio/sync", "tokio/parking_lot"]
|
||||
client = ["dep:hyper-rustls", "hyper/tcp", "dep:tokio", "tokio?/sync", "tokio?/parking_lot"]
|
||||
|
||||
@@ -32,7 +32,7 @@ pub enum Error<Service> {
|
||||
Service { inner: Service },
|
||||
|
||||
#[error("could not serialize JSON payload")]
|
||||
Json {
|
||||
Serialize {
|
||||
#[source]
|
||||
inner: serde_json::Error,
|
||||
},
|
||||
@@ -43,8 +43,8 @@ impl<S> Error<S> {
|
||||
Self::Service { inner: source }
|
||||
}
|
||||
|
||||
fn json(source: serde_json::Error) -> Self {
|
||||
Self::Json { inner: source }
|
||||
fn serialize(source: serde_json::Error) -> Self {
|
||||
Self::Serialize { inner: source }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ where
|
||||
|
||||
let body = match serde_json::to_vec(&body) {
|
||||
Ok(body) => Full::new(Bytes::from(body)),
|
||||
Err(err) => return std::future::ready(Err(Error::json(err))).left_future(),
|
||||
Err(err) => return std::future::ready(Err(Error::serialize(err))).left_future(),
|
||||
};
|
||||
|
||||
let request = Request::from_parts(parts, body);
|
||||
|
||||
@@ -27,7 +27,7 @@ pub enum Error<Service> {
|
||||
Service { inner: Service },
|
||||
|
||||
#[error("could not parse JSON payload")]
|
||||
Serialize {
|
||||
Deserialize {
|
||||
#[source]
|
||||
inner: serde_json::Error,
|
||||
},
|
||||
@@ -38,8 +38,8 @@ impl<S> Error<S> {
|
||||
Self::Service { inner: source }
|
||||
}
|
||||
|
||||
fn serialize(source: serde_json::Error) -> Self {
|
||||
Self::Serialize { inner: source }
|
||||
fn deserialize(source: serde_json::Error) -> Self {
|
||||
Self::Deserialize { inner: source }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ where
|
||||
let response = res.map_err(Error::service)?;
|
||||
let (parts, body) = response.into_parts();
|
||||
|
||||
let body = serde_json::from_reader(body.reader()).map_err(Error::serialize)?;
|
||||
let body = serde_json::from_reader(body.reader()).map_err(Error::deserialize)?;
|
||||
|
||||
let res = Response::from_parts(parts, body);
|
||||
Ok(res)
|
||||
|
||||
Reference in New Issue
Block a user