client: Small refactoring

This commit is contained in:
Jonas Platte 2021-04-28 13:16:43 +02:00
parent ac78c855a8
commit 71b4463306
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 2 additions and 21 deletions

View File

@ -61,13 +61,7 @@ pub trait HttpClientExt: HttpClient {
access_token: SendAccessToken<'_>,
request: R,
) -> Pin<Box<dyn Future<Output = ResponseResult<Self, R>> + 'a>> {
Box::pin(crate::send_customized_request(
self,
homeserver_url,
access_token,
request,
|_| {},
))
self.send_customized_request(homeserver_url, access_token, request, |_| {})
}
/// Turn a strongly-typed matrix request into an `http::Request`, customize it and send it to

View File

@ -159,20 +159,7 @@ impl<C: HttpClient> Client<C> {
&self,
request: R,
) -> Result<R::IncomingResponse, Error<C::Error, R::EndpointError>> {
let access_token = self.access_token();
let send_access_token = match access_token.as_deref() {
Some(at) => SendAccessToken::IfRequired(at),
None => SendAccessToken::None,
};
send_customized_request(
&self.0.http_client,
&self.0.homeserver_url,
send_access_token,
request,
|_| {},
)
.await
self.send_customized_request(request, |_| {}).await
}
/// Makes a request to a Matrix API endpoint including additional URL parameters.