rest-api

Crates.iorest-api
lib.rsrest-api
version0.1.8
created_at2025-01-14 04:20:00.431662+00
updated_at2025-02-09 23:03:52.647218+00
descriptionLibrary for REST API
homepage
repositoryhttps://github.com/biyard/rust-sdk/tree/main/packages/rest-api
max_upload_size
id1515442
size66,932
hackartist (hackartists)

documentation

README

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");
Commit count: 608

cargo fmt