mirror of
https://git.proxmox.com/git/proxmox
synced 2025-06-24 23:21:17 +00:00

to allow get requests with extra headers (such as `Authorization`) and a generic `request` fn to increase flexibility even more. this is a breaking change. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
22 lines
475 B
Rust
22 lines
475 B
Rust
use std::collections::HashMap;
|
|
|
|
use anyhow::Error;
|
|
use http::{Request, Response};
|
|
|
|
pub trait HttpClient<T> {
|
|
fn get(
|
|
&self,
|
|
uri: &str,
|
|
extra_headers: Option<&HashMap<String, String>>,
|
|
) -> Result<Response<T>, Error>;
|
|
|
|
fn post(
|
|
&self,
|
|
uri: &str,
|
|
body: Option<&str>,
|
|
content_type: Option<&str>,
|
|
) -> Result<Response<T>, Error>;
|
|
|
|
fn request(&self, request: Request<T>) -> Result<Response<T>, Error>;
|
|
}
|