#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

#50 in #reqwest

Download history 9/week @ 2024-09-13 67/week @ 2024-09-20 55/week @ 2024-09-27 9/week @ 2024-10-04 15/week @ 2024-10-11 39/week @ 2024-10-18 17/week @ 2024-10-25 34/week @ 2024-11-01

107 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

~5–17MB
~226K SLoC