Need help with attohttpc?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

sbstp
159 Stars 13 Forks Mozilla Public License 2.0 232 Commits 10 Opened issues

Description

Rust lightweight HTTP 1.1 client

Services available

!
?

Need anything else?

Contributors list

# 64,513
D
Rust
automat...
nfa
117 commits
# 247,692
Shell
C++
Rust
dimensi...
55 commits
# 52,344
Python
Shell
unix
libc
4 commits
# 235,900
Shell
C
Rust
passwor...
3 commits
# 158,374
Shell
HTML
C
aes
2 commits
# 125,920
Rust
sed
coffees...
Atom
1 commit
# 317,901
Shell
gtk
vala
element...
1 commit
# 177,350
Homebre...
libnx
hue-lig...
imagema...
1 commit
# 100,216
Twitch
hlsl
glsl
gmail
1 commit
# 34,500
Rust
Electro...
openvpn
argumen...
1 commit

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
  • 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)
  • rustls
    or
    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.
rust
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, Bodies, etc.
  • TLS, adding trusted certificates, disabling verification, etc. for both
    native-tls
    and
    rustls
  • Automatic redirection
  • Streaming response body
  • Multiple text encodings
  • Automatic compression/decompression with gzip or deflate
  • Transfer-Encoding: chunked
  • serde/json support
  • HTTP Proxies &
    HTTP_PROXY
    ,
    HTTPS_PROXY
    ,
    NO_PROXY
    environment variables.
  • Happy Eyeballs
  • Authentication (partial support)

License

This project is licensed under the

MPL-2.0
.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.