7 releases

✓ Uses Rust 2018 edition

new 0.5.1 Nov 11, 2019
0.5.0 Nov 8, 2019
0.4.5 Sep 3, 2019
0.4.1 Mar 23, 2019
0.3.0 Mar 23, 2019

#13 in HTTP client

Download history 443/week @ 2019-07-29 930/week @ 2019-08-05 793/week @ 2019-08-12 1292/week @ 2019-08-19 1250/week @ 2019-08-26 1964/week @ 2019-09-02 1332/week @ 2019-09-09 1460/week @ 2019-09-16 1556/week @ 2019-09-23 565/week @ 2019-09-30 1314/week @ 2019-10-07 1130/week @ 2019-10-14 1409/week @ 2019-10-21 1166/week @ 2019-10-28 1023/week @ 2019-11-04

5,339 downloads per month
Used in 7 crates (3 directly)

MPL-2.0 license

78KB
2K SLoC

attohttpc

Documentation | Crates.io | Repository

Why attohttpc?

This project's goal is to provide a lightweight and simple HTTP client for the Rust ecosystem. The intended use is for projects that have HTTP needs where performance is not critical or when HTTP is not the main purpose of the application. Note that the project still tries to perform well and avoid allocation where possible, but stays away from Rust's asynchronous stack to provide a crate that's as small as possible. Features are provided behind feature flags when possible to allow users to get just what they need. Here are the goals of the project:

  • Lightweight
  • Secure
  • Easy to use
  • Modular
  • HTTP/1.1, eventually HTTP/2.0
  • Use quality crates from the ecosystem (http, url, encoding_rs), not reinventing the wheel.

Features

  • charsets support for decoding more text encodings than just UTF-8
  • compress support for decompressing response bodies (default)
  • json support for serialization and deserialization
  • tls support for tls connections (default)

Usage

See the examples/ folder in the repository for more use cases.

let (status, headers, body) = attohttpc::post("https://my-api.com/do/something").json(&request)?.send()?;
if status.is_success() {
    let response = body.json()?;
    // ...
}

Current feature set

  • Query parameters
  • Request headers
  • Tls
  • Automatic redirection
  • Streaming response body
  • Text encoding support
  • Gzip, deflate support
  • Transfer-Encoding: chunked
  • serde support behind a feature flag

Features being worked on

  • File upload, form data
  • Thorough test suite
  • Connection: keep-alive
  • Authentication

License

This project is licensed under the MPL-2.0.

Dependencies

~1.8–3.5MB
~97K SLoC