mastodon API rust lib elefren, fixed and updated. and also all ASYNC! NB. most examples are now wrong.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
elefren-fork/src/http_send.rs

18 lines
524 B

use reqwest::{Client, Request, RequestBuilder, Response};
use Result;
pub trait HttpSend {
fn execute(&self, client: &Client, request: Request) -> Result<Response>;
fn send(&self, client: &Client, builder: &mut RequestBuilder) -> Result<Response> {
let request = builder.build()?;
self.execute(client, request)
}
}
pub struct HttpSender;
impl HttpSend for HttpSender {
fn execute(&self, client: &Client, request: Request) -> Result<Response> {
Ok(client.execute(request)?)
}
}