Surf is a friendly HTTP client built for casual Rustaceans and veterans alike.
It's completely modular, and built directly for async/await
. Whether it's a
quick script, or a cross-platform SDK, Surf will make it work.
- Multi-platform out of the box
- Extensible through a powerful middleware system
- Reuses connections through the
Client
interface - Fully streaming requests and responses
- TLS/SSL enabled by default
- Swappable HTTP backends
- HTTP/2 enabled by default
Examples
async
It's also possible to skip the intermediate Response
, and access the response
type directly.
async
Both sending and receiving JSON is real easy too.
use ;
async
And even creating streaming proxies is no trouble at all.
async
Installation
Safety
This crate makes use of a single instance of unsafe
in order to make the WASM
backend work despite the Send
bounds. This is safe because WASM targets
currently have no access to threads. Once they do we'll be able to drop this
implementation, and use a parked thread instead and move to full multi-threading
in the process too.
Contributing
Want to join us? Check out our "Contributing" guide and take a look at some of these issues:
See Also
Thanks
Special thanks to prasannavl for donating the
crate name, and sagebind for creating an easy to
use async
curl client that saved us countless hours.
License
MIT OR Apache-2.0