opentalk_client_shared/request/with_authorization.rs
1// SPDX-FileCopyrightText: OpenTalk GmbH <mail@opentalk.eu>
2//
3// SPDX-License-Identifier: EUPL-1.2
4
5use http_request_derive::HttpRequest;
6
7use crate::{Authorization, AuthorizedHttpRequest};
8
9/// Trait for adding authorization information to http requests
10pub trait WithAuthorization: HttpRequest + Sized {
11 /// Augment the request with authorization information
12 fn with_authorization<A: Authorization>(
13 self,
14 authorization: A,
15 ) -> AuthorizedHttpRequest<A, Self> {
16 AuthorizedHttpRequest::new(authorization, self)
17 }
18}
19
20impl<R: HttpRequest + Sized> WithAuthorization for R {}