#http-client #http-request #async-http #http #web #axios

raxios

An easy to use HTTP client for Rust based off of JS Axios library

18 releases (5 breaking)

0.5.2 Oct 1, 2022
0.5.1-alpha Sep 22, 2022
0.4.0-alpha Sep 22, 2022
0.3.1-alpha Sep 21, 2022
0.0.5-alpha Sep 20, 2022

#43 in #reqwest

Download history 21/week @ 2024-07-08 16/week @ 2024-09-16 105/week @ 2024-09-23 12/week @ 2024-09-30 13/week @ 2024-10-07 14/week @ 2024-10-14

144 downloads per month
Used in nexus_mods_api

MIT license

47KB
921 lines

Raxios

Async-centered Rust library similar to the JS library "axios"

!DISCLAIMER! While Raxios is in an alpha state, consider any minor version changes to be breaking changes. Raxios will not be out of Alpha state and stable until the 1.0.0 release.

Features

  • JSON, XML, and URL-Encoded Serialization
  • JSON Deserialization (XML and others to come)
  • An "axios"-like api

Usage/Examples

use raxios::Raxios;

#[derive(serde::Serialize, serde::Deserialize, Debug)]
struct ToReceive {
    field1: String
}

#[derive(serde::Serialize, serde::Deserialize, Debug)]
struct ToSend {
    field1: String
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {

    // An error _might_ occur here if you try to set non-valid headers in the Options
    let client = Raxios::new("", None)?;

    let data_to_send = ToSend { field1 : String::from("Hello World") };

    let result = client
        .post::<ToReceive, ToSend>("/endpoint", Some(data_to_send), None)
        .await?;

    println!("{0}", result.body.unwrap());
}

Documentation

docs.rs

License

MIT

docs.rs downloads Version
docs.rs Crates.io Crates.io

Dependencies

~4–19MB
~237K SLoC