opentalk_client_shared/request/
with_authorization.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// SPDX-FileCopyrightText: OpenTalk GmbH <mail@opentalk.eu>
//
// SPDX-License-Identifier: EUPL-1.2

use http_request_derive::HttpRequest;

use crate::{Authorization, AuthorizedHttpRequest};

/// Trait for adding authorization information to http requests
pub trait WithAuthorization: HttpRequest + Sized {
    /// Augment the request with authorization information
    fn with_authorization<A: Authorization>(
        self,
        authorization: A,
    ) -> AuthorizedHttpRequest<A, Self> {
        AuthorizedHttpRequest::new(authorization, self)
    }
}

impl<R: HttpRequest + Sized> WithAuthorization for R {}