7 releases

0.1.8 Feb 9, 2025
0.1.7 Feb 1, 2025
0.1.6 Jan 28, 2025

#946 in Magic Beans

Download history 320/week @ 2025-01-14 149/week @ 2025-01-21 224/week @ 2025-01-28 118/week @ 2025-02-04 59/week @ 2025-02-11

565 downloads per month
Used in 2 crates

Apache-2.0

18KB
281 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
~452K SLoC