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

#1812 in Web programming

Download history 3/week @ 2024-01-15 2/week @ 2024-01-22 22/week @ 2024-02-05 339/week @ 2024-02-26 4/week @ 2024-03-04

343 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–18MB
~259K SLoC