Skip to content

2.3.0

Compare
Choose a tag to compare
@Fishrock123 Fishrock123 released this 23 Aug 22:45
· 12 commits to main since this release

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 configure surf::Client-s!
    • Config::add_header() - client-wide headers
    • Config::set_base_url() - client-wide base url
    • Config::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 on h1-client or h1-client-rustls.
    • More config may be available from the underlying http_client::Config.
    • Easily turns into a Client via std::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 and hyper-client backends already did this.
  • The wasm-client feature now pulls in getrandom'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 of Config.

Docs

  • Several docs fixes
  • Minor 'branding' changes