Skip to content

arraypad/attohttpc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

197 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  • form support for url encoded forms (does not include support for multipart)
  • tls support for tls connections (default)
  • tls-rustls support for TLS connections using rustls instead of native-tls
  • multipart-form support for multipart forms (does not include support for url encoding)

Usage

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

let resp = attohttpc::post("https://my-api.com/do/something").json(&request)?.send()?;
if resp.is_success() {
    let response = resp.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
  • Authentication (partial support)
  • Happy Eyeballs

Features being worked on

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

License

This project is licensed under the MPL-2.0.

About

Rust lightweight HTTP 1.1 client

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Rust 99.7%
  • Shell 0.3%