Crates.io | raxios |
lib.rs | raxios |
version | 0.5.2 |
source | src |
created_at | 2022-09-20 00:02:08.626337 |
updated_at | 2022-10-01 20:29:43.232488 |
description | An easy to use HTTP client for Rust based off of JS Axios library |
homepage | |
repository | https://github.com/dbidwell94/raxios |
max_upload_size | |
id | 669454 |
size | 48,460 |
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.
JSON, XML, and URL-Encoded Serialization
JSON Deserialization (XML and others to come)
An "axios"-like api
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());
}
docs.rs | downloads | Version |
---|---|---|