2.3.0
surf
is a modular Rust HTTP client built for rapid development. It comes with a powerful middleware system and feature-swappable backend implementations. It is part of the http-rs
project and a counterpart to the tide
server framework. Check out the docs or join us on Zulip
(v2.3.0 was yanked, faulty git base - v2.3.1 instead)
Additions
surf::Config
, a way to configuresurf::Client
-s!Config::add_header()
- client-wide headersConfig::set_base_url()
- client-wide base urlConfig::set_http_keep_alive()
Config::set_tcp_no_delay()
Config::set_timeout()
- per-request timeout.Config::set_max_connections_per_host()
Config::set_tls_config()
- only available onh1-client
orh1-client-rustls
.- More config may be available from the underlying
http_client::Config
. - Easily turns into a
Client
viastd::convert::TryInto
.
- Extra
RequestBuilder
helpers for setting the body from different sources.body_json()
,body_string()
,body_bytes()
,body_file()
.
Client::request()
for making arbitrary HTTP-method requests from a client.
Improvements
- The
h1-client
backend now uses a shared client for 'one-off' style (surf::get()
, etc) requests.- The
curl-client
andhyper-client
backends already did this.
- The
- The
wasm-client
feature now pulls ingetrandom
's"js"
feature.- This isn't a problem since the wasm client only works in a web/emscripten environment anyways.
Deprecations
Client::set_base_url
has been deprecated in favor ofConfig
.
Docs
- Several docs fixes
- Minor 'branding' changes