1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-21 23:00:50 +03:00

Layer to application/x-www-form-urlencoded bodies

This commit is contained in:
Quentin Gliech
2022-08-12 16:49:54 +02:00
parent 398379e21b
commit d94442f972
7 changed files with 142 additions and 8 deletions

View File

@@ -27,7 +27,7 @@ pub enum Error<Service> {
Service { inner: Service },
#[error("could not parse JSON payload")]
Json {
Serialize {
#[source]
inner: serde_json::Error,
},
@@ -38,8 +38,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 }
}
}
@@ -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::json)?;
let body = serde_json::from_reader(body.reader()).map_err(Error::serialize)?;
let res = Response::from_parts(parts, body);
Ok(res)