pub trait Http {
    type Headers: BufRead + Unpin;
    type ResponseBody: BufRead;
    type PostBody: Write;
    fn get(
        &mut self,
        url: &str,
        headers: impl IntoIterator<Item = impl AsRef<str>>
    ) -> Result<GetResponse<Self::Headers, Self::ResponseBody>, Error>; fn post(
        &mut self,
        url: &str,
        headers: impl IntoIterator<Item = impl AsRef<str>>
    ) -> Result<PostResponse<Self::Headers, Self::ResponseBody, Self::PostBody>, Error>; }
Expand description

A trait to abstract the HTTP operations needed to power all git interactions: read via GET and write via POST.

Associated Types

A type providing headers line by line.

A type providing the response.

A type allowing to write the content to post.

Required methods

Initiate a GET request to url provided the given headers.

The headers are provided verbatim and include both the key as well as the value.

Initiate a POST request to url providing with the given headers.

The headers are provided verbatim and include both the key as well as the value. Note that the PostResponse contains the post_body field which implements std::io::Write and is expected to receive the body to post to the server. It must be dropped before reading the response to prevent deadlocks.

Implementors