5 releases

new 0.1.6 Jan 28, 2025
0.1.3 Jan 22, 2025
0.1.2 Jan 17, 2025
0.1.1 Jan 14, 2025
0.1.0 Jan 14, 2025

#623 in Magic Beans

Download history 307/week @ 2025-01-13 155/week @ 2025-01-20

462 downloads per month
Used in 2 crates

Apache-2.0

18KB
198 lines

REST API

Usage

Register hook

fn init() {
  let hooker = Hook::new();
  rest_api::add_hook(hooker);
}

struct Hook {}

impl rest_api::RequestHooker for Hook {
    fn before_request(&self, req: reqwest::RequestBuilder) -> reqwest::RequestBuilder {
        req.header("Authorization", format!("Bearer token"))
    }
}

Call API

  • Below code will call before_request function
rest_api::get("http://localhost:3000/version");

Dependencies

~12–25MB
~453K SLoC