A way to impersonate a user when calling query
Hiya
First of all thanks a bunch for the repo
I would like to impersonate a user when calling query. Afaik Gitlab requests with tokens are done using the --header "PRIVATE-TOKEN: <your_access_token>"
I was wondering if this can be used not only while creating a client, but also when calling the endpoint.
pub trait Endpoint {
/// The HTTP method to use for the endpoint.
fn method(&self) -> Method;
/// The path to the endpoint.
fn endpoint(&self) -> Cow<'static, str>;
/// Query parameters for the endpoint.
fn parameters(&self) -> QueryParams {
QueryParams::default()
}
/// The body for the endpoint.
///
/// Returns the `Content-Encoding` header for the data as well as the data itself.
fn body(&self) -> Result<Option<(&'static str, Vec<u8>)>, BodyError> {
Ok(None)
}
}
In my opinion maybe a possible solution would be to add fn headers(&self) -> HeaderMap<HeaderValue>
. So I can override the headers, however I'm not sure if this is the way to go. Maybe an impersonate()
would also work in this case.
Currently I'm creating a new client for each user. But I'm not sure if this makes sense.
Many thanks in advance
Edited by Aliyss Snow