#io #async #futures #service #http

tower-http

Tower middleware and utilities for HTTP clients and servers

12 unstable releases (3 breaking)

0.3.4 Jun 6, 2022
0.3.2 Apr 29, 2022
0.2.5 Mar 11, 2022
0.2.0 Dec 1, 2021
0.0.0 Mar 10, 2017

#18 in Network programming

Download history 124824/week @ 2022-06-13 148512/week @ 2022-06-20 161368/week @ 2022-06-27 162853/week @ 2022-07-04 174083/week @ 2022-07-11 159932/week @ 2022-07-18 155107/week @ 2022-07-25 176046/week @ 2022-08-01 179865/week @ 2022-08-08 174311/week @ 2022-08-15 182951/week @ 2022-08-22 178486/week @ 2022-08-29 173158/week @ 2022-09-05 187527/week @ 2022-09-12 201725/week @ 2022-09-19 190793/week @ 2022-09-26

759,992 downloads per month
Used in 380 crates (94 directly)

MIT license

565KB
11K SLoC

Tower HTTP

Tower middleware and utilities for HTTP clients and servers.

Build status Crates.io Documentation Crates.io

More information about this crate can be found in the crate documentation.

Middleware

Tower HTTP contains lots of middleware that are generally useful when building HTTP servers and clients. Some of the highlights are:

  • Trace adds high level logging of requests and responses. Supports both regular HTTP requests as well as gRPC.
  • Compression and Decompression to compress/decompress response bodies.
  • FollowRedirect to automatically follow redirection responses.

See the docs for the complete list of middleware.

Middleware uses the http crate as the HTTP interface so they're compatible with any library or framework that also uses http. For example hyper.

The middleware were originally extracted from one of @EmbarkStudios internal projects.

Examples

The examples folder contains various examples of how to use Tower HTTP:

Minimum supported Rust version

tower-http's MSRV is 1.51.

Getting Help

If you're new to tower its guides might help. In the tower-http repo we also have a number of examples showing how to put everything together. You're also welcome to ask in the #tower Discord channel or open an issue with your question.

Contributing

🎈 Thanks for your help improving the project! We are so happy to have you! We have a contributing guide to help you get involved in the Tower HTTP project.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tower HTTP by you, shall be licensed as MIT, without any additional terms or conditions.

Dependencies

~1.1–4MB
~81K SLoC