Error::url()
to access the URL of an error.Response::extensions()
to access the http::Extensions
of a response.rustls-native-certs
to log an error instead of panicking when loading an invalid system certificate.ClientBuilder::http09_responses(bool)
option to allow receiving HTTP/0.9 responses.blocking::ClientBuilder::resolve()
option, matching the async builder.From<tokio::fs::File>
for Body
.blocking
request-scoped timeout applying to bodies as well.rustls
to 0.20.ClientBuilder::http1_only()
method.tls::Version
type, and ClientBuilder::min_tls_version()
and ClientBuilder::max_tls_version()
methods.TryFrom<Request>
for http::Request
.Clone
for Identity
.NO_PROXY
environment variable parsing to more closely match curl's. Comma-separated entries are now trimmed for whitespace, and *
is allowed to match everything.https_only
option.Body::as_bytes()
method.JsValue
.ClientBuilder::resolve()
option to override DNS resolution for specific domains.native-tls-alpn
Cargo feature to use ALPN with the native-tls backend.ClientBuilder::deflate()
option and deflate
Cargo feature to support decoding response bodies using deflate.RequestBuilder::version()
to allow setting the HTTP version of a request.rustls-tls
backend, when the server uses TLS v1.2 or v1.3.try_clone
to Request
and RequestBuilder
impl From<hyper::Body> for reqwest::Body
.RequestBuilder
.CookieStore
trait to customize the type that stores and retrieves cookies for a session.cookie::Jar
as a default CookieStore
, easing creating some session cookies before creating the Client
.ClientBuilder::http2_adaptive_window()
option to configure an adaptive HTTP2 flow control behavior.ClientBuilder::http2_max_frame_size()
option to adjust the maximum HTTP2 frame size that can be received.IntoUrl
for String
, making it more convenient to create requests with format!
.ClientBuilder::tls_built_in_root_certs()
option to disable built-in root certificates.rustls-tls
glue to more often support ALPN to upgrade to HTTP/2.http://
if no scheme is found.runtime
feature.Request::new()
constructor.Change multipart
to be an optional cargo feature.
Remove deprecated methods.
Update to Tokio v1.0.
Update to Bytes v1.0.
Update to hyper v0.14.
tcp_keepalive
option to blocking::ClientBuilder
.multipart::Part::stream_with_length
constructor, to create a streaming part with a known length.ClientBuilder::https_only
option, to allow requiring URLs to be https
.tcp_keepalive
value to be disabled.rustls-tls-native-roots
, rustls-tls-webpki-roots
, and rustls-tls-manual-roots
Cargo features, to configure which certificate roots to use with rustls.ClientBuilder::tcp_keepalive()
method to enable TCP keepalive.ClientBuilder::http1_writev()
method to force enable or disable vectored writes.Error::is_connect()
method to identify if the error is related to connection-establishment.blocking::ClientBuilder::brotli()
method.ClientBuilder::default_headers()
method.RequestBuilder::build()
method.must_use
to RequestBuilder
and ClientBuilder
.headers
method to RequestBuilder
.execute
method to Client
.TryFrom<http::Request>
for Request
.window
to work in non-browser environments.NO_PROXY
environment variable support.Error::{is_request, is_body, is_decode}
getters.reqwest::ClientBuilder
to reqwest::blocking::ClientBuilder
.headers_mut()
to reqwest::blocking::Response
.form()
, query()
, multipart
and bearer_auth()
to RequestBuilder
.http:
or https:
schemes, returning an error instead.ClientBuilder::pool_idle_timeout
option.ClientBuilder::pool_max_idle_per_host
option, deprecate max_idle_per_host
.Response::content_length
for WASM target.TryFrom<http::Request>
for blocking::Request
.TryFrom<http::Request>
for Request
.From<http::Request>
for Request
.http::Request
to a reqwest::Request
in an infallible fashion. It would panic if the conversion was not possible. Instead, the implementation has been changed to TryFrom
to indicate it could fail.trust-dns
optional feature to change DNS resolver.bytes()
method to reqwest::blocking::Response
.buffer()
method to reqwest::blocking::Body
.From<http::Request>
for reqwest::Request
.rustls
version.brotli
feature.Client::use_preconfigured_tls(tls_connector)
allowing manual configuration of TLS options.Default
for blocking Client
, ClientBuilder
, and multipart::Form
.Response::error_for_status()
method.Response::json()
method.Default
for Client
and ClientBuilder
.socks
optional feature to support SOCKS5 proxies.RequestBuilder::timeout()
to configure a timeout for a single request, instead of using the client's timeout.ClientBuilder::connection_verbose()
option to enable verbose IO logs.RequestBuilder::fetch_mode_no_cors()
option.Response::url()
getter method.Add std::future::Future
support.
Add wasm32-unknown-unknown
support (with fewer features).
Add ability to pass async Response
as the body
of another Request
.
Add Body::as_bytes()
method.
Add Response::bytes_stream()
method to get body as an impl Stream
.
Add Request::try_clone()
method.
Change default Client
API to async. The previous blocking client API is available at reqwest::blocking
.
Change to no longer send a default User-Agent
header. Add one via ClientBuilder::user_agent()
.
Change to enable system/environment proxy detection by default.
Change default-tls
feature to only include ClientBuilder
options that both native-tls
and rustls
support.
Change default feature set to reduce unnecessary dependencies. Most features are disabled by default:
blocking
: The reqwest::blocking
(synchronous) client API.cookies
: Cookie store support.gzip
: Automatic response body decompression.json
: Request and response JSON body methods.stream
: futures::Stream
support.Change Error
internal design, removing several Error::is_*
inspector methods.
Change Redirect API:
redirect
module (for example, reqwest::RedirectPolicy
is now reqwest::redirect::Policy
).loop_detected
and too_many_redirect
methods from redirect::Attempt
, replaced with a generic error
method.Fix checking HTTP_PROXY
environment variable if it the environment is from a CGI script.
Fix removal of username/password of parsed proxy URL.
Update url
to v2.0.
Update hyper
to v0.13.
Update http
to v0.2.
ClientBuilder::use_sys_proxy()
to enable automatic detect of HTTP proxies configured on the system.ClientBuilder::no_proxy()
to disable system proxies. This is the default for 0.9, but will change to detecting system proxies by default in 0.10.async::Response::text()
that returns a Future
of the full body decoded to a String
.Clone
for Certificate
.Cookie
headers to no longer send as percent-encoded (instead, exactly as sent by the server).Cookie
headers so as to not include attributes from the Set-Cookie
(like HttpOnly
, Secure
, etc).Response::text_with_charset()
to allow setting the default charset to decode.Error::source()
implementation.async::ClientBuilder::timeout()
option, will timeout the connect, request, and response body futures.RequestBuilder::query()
to not add just "?"
if the encoded query is empty.socks5
cargo feature.Client
, automatically handling cookies for a session.ClientBuilder::cookie_store(enable: bool)
method to enable a cookie store that persists across requests.Response::cookies()
accessor that allows iterating over response cookies.Proxy
to check the URL for a username and password.Location
headers during redirects (error is logged and redirect response is returned instead).ClientBuilder::tcp_nodelay()
to allow disabling Nagle's algorithm.ClientBuilder::max_idle_per_host()
to allow reducing the number of idle pooled connections.RequestBuilder::bearer_auth()
method to async builder.RequestBuilder::basic_auth()
.multipart::Form::percent_encode_noop()
to allow for servers which don't support percent encoding of parameters.ClientBuilder::http1_title_case_headers()
to force request headers to use Title-Case.ClientBuilder::connect_timeout()
to allow setting only a connect timeout.ClientBuilder::local_address()
to bind to a local IP address.Response::error_for_status_ref()
to return an Error
while borrowing a Response
.Identity::from_pem
with rustls-tls
backend when using RSA private keys.ClientBuilder::h2_prior_knowledge()
option to force HTTP2.Response::content_length()
to get the content-length of a response.getaddrinfo
in a threadpool. There is now a trust-dns
optional feature to enable the Trust-DNS resolver.Certificate
and Identity
errors at construction time.getaddrinfo
).filename
s in multipart/form-data
requests.Proxy::basic_auth
method to support proxy authorization.rustls-tls
optional feature to use rustls instead of native-tls.try_clone
method to Request
and RequestBuilder
.reqwest::async::multipart
support, similar to the synchronous API.default-tls-vendored
optional feature to vendor OpenSSL.reqwest::get
if client builder fails to build.reqwest::Client
runtime to startup.RequestBuilder::headers
to properly append extra headers of the same name.getaddrinfo
with a non-blocking DNS resolver.Response::remote_addr()
method to check the address of the connection used.default-tls
crate feature, enabled by default, which allows users to disable TLS.percent_encoding_path_segment
and percent_encoding_attr_char
configuration to multipart::Form
.multipart::Form
default percent encoding format to path-segment
.multipart::Part::bytes()
to create a part of raw bytes.Response
to help with testing.Location
header has UTF-8 characters.POST
into a GET
.Response
and Error
signicantly.tokio
0.1.hyper
0.12.native-tls
0.2.ClientBuilder::danger_accept_invalid_certs(bool)
to disable certificate verification.RequestBuilder::bearer_auth(token)
to ease sending bearer tokens.headers()
and headers_mut()
to multipart::Part
to allow sending extra headers for a specific part.request::unstable::async
to reqwest::async
.Url
with a file://
scheme. Instead, an Error
is returned.Changed ClientBuilder::danger_disable_hostname_verification()
to ClientBuilder::danger_accept_invalid_hostnames(bool)
.
Changed ClientBuilder
to be a by-value builder instead of by-ref.
For single chains of method calls, this shouldn't affect you. For code that conditionally uses the builder, this kind of change is needed:
// Old let mut builder = ClientBuilder::new(); if some_val { builder.gzip(false); } let client = builder.build()?; // New let mut builder = ClientBuilder::new(); if some_val { builder = builder.gzip(false); } let client = builder.build()?;
Changed RequestBuilder
to be a by-value builder of by-ref.
See the previous note about ClientBuilder
for affected code and how to change it.
Removed the unstable
cargo-feature, and moved reqwest::unstable::async
to reqwest::async
.
Changed multipart::Part::mime()
to mime_str()
.
// Old let part = multipart::Part::file(path)? .mime(mime::TEXT_PLAIN); // New let part = multipart::Part::file(path)? .mime_str("text/plain")?;
The upgrade to hyper
0.12 means a temporary removal of the typed headers.
The RequestBuilder
has simple methods to set headers using strings, which can work in most places.
// Old client .get("https://hyper.rs") .header(UserAgent::new("hallo")) .send()?; // New client .get("https://hyper.rs") .header("user-agent", "hallo") .send()?;
To ease the transition, there is a hyper-011
cargo-feature that can be enabled.
[dependencies] reqwest = { version = "0.9", features = ["hyper-011"] }
And then usage:
client .get("https://hyper.rs") .header_011(reqwest::hyper_011::header::UserAgent::new("hallo")) .send()?;
tokio-proto
, which removed unsafe small-vec
dependency.RedirectAttempt::status
to check status code that triggered redirect.RedirectPolicy::redirect
method publicly, to allow composing policies.Response::text()
.Certificate::from_pem
to load PEM encoded client certificates.query
, form
, and json
.unstable::async::RequestBuilder::query
, mirroring the stable builder method.RequestBuilder::query
to easily adjust query parameters of requests.no_proto
config, fixing several bugs in hyper.ClientBuilder::default_headers
to set headers used for every request.async::ClientBuilder::dns_threads
to set number of threads use for DNS.Response::text
as shortcut to read the full body into a String
.Response::copy_to
as shortcut for std::io::copy
.ClientBuilder
and RequestBuilder
hold their errors till consumed (#189)async::Response::body()
now returns a reference to the body instead of consuming the Response
reqwest::Client
is used set to 30 seconds (#181)Client::new
no longer returns a Result
.
To handle any panics that come from Client::new
, the builder can be used instead.
ClientBuilder
and RequestBuilder
hold their errors till consumed (#189).
This means a bunch of ?
will be going away, but means using the builders will be far easier now. Any error encountered inside the builders will now be returned when the builder is consumed.
To get errors back immediately, the Request
type can be used directly, by building pieces separately and calling setters.
async::Response::body()
now returns a reference to the body instead of consuming the Response
.
A default timeout for reqwest::Client
is used set to 30 seconds (#181)
For uses where the timeout is too short, it can be changed on the ClientBuilder
, using the timeout
method. Passing None
will disable the timeout, reverting to the pre-0.8 behavior.
Proxy::custom(fn)
to allow dynamically picking a proxy URLClient
or Response
are dropping.Authorization<Basic>
header was added (https://github.com/seanmonstar/reqwest/commit/cf246d072badd9b31b487e7a0b00490e4cc9584f)println
s in the sending of a bodyRequest
type that can be used instead of the RequestBuilder
(#85)Response::error_for_status()
to easily convert 400 and 500 status responses into an Error
(#98)Client
remains.unstable
Cargo feature to enable reqwest::unstable::async
.RedirectAction
and RedirectAttempt
Error::get_ref
returns Error + Send + Sync
header
, StatusCode
, and Method
have breaking changes.mime
has been ugpraded to 0.3, with a very different API.Client
, and moved to the ClientBuilder
.HttpVersion
type was completely removed.Error::cause()
now returns Error::get_ref().cause()
.Client
that start a RequestBuilder
now return a Result
immediately, instead of delaying the URL parse error for later.RequestBuilder
methods all take &mut self
, instead of moving the builder, and return &mut Self
. (This shouldn't actually affect most people who are building a request in a single chain.)Response::status()
returns a StatusCode
instead of &StatusCode
.Client::referer(bool)
option to disable setting the Referer
header during redirects (https://github.com/seanmonstar/reqwest/commit/bafcd7ae6fc232856dd6ddb8bf5b20dbbbfe0bc9)Error::get_ref
to get the underlying error that may have occurred. Includes a 'static
bounds, which allows for downcasting (as opposed to Error::cause
).1.0
url
method to Error
, which returns a possible associated Url
that occurred with this error.req.basic_auth(user, optional_pass)
method to ease using Basic
authentication.[email protected]
. Mismatched version will give a compiler error that a serde trait is not implemented.Error
is no longer an enum
, but an opaque struct. Details about it can be checked with std::error::Error::cause()
, and methods on reqwest::Error
include is_http()
, is_serialization()
, and is_redirect()
.RedirectPolicy::custom
receives different arguments, and returns different values. See the docs for an example.Clone
implementation for Client
Client
will try to decode any responses that appear to be gzip encoded (based on headers). This can be disabled via client.gzip(false)
(https://github.com/seanmonstar/reqwest/commit/ab5e477a123319efd4b17f3666b41b44ec244bee)client.timeout(duration)
. (https://github.com/seanmonstar/reqwest/commit/ec049fefbae7355f6e4ddbbc7ebedcadb30e1e04)Body::sized()
(https://github.com/seanmonstar/reqwest/commit/82f1877d4b6cba2fac432670ec306160aee5c501)Client.put
, Client.patch
, and Client.delete
convenience methods (https://github.com/seanmonstar/reqwest/commit/c37b8aa0338ac4142763d206c6df79856915056d, https://github.com/seanmonstar/reqwest/commit/4d6582d22b23c27927e481a9c8a83ad08cfd1a2a, https://github.com/seanmonstar/reqwest/commit/a3983f3122b2d1495ea36bb5a8fd019a7605ae56)reqwest::mime
(https://github.com/seanmonstar/reqwest/commit/0615c6d65e03ba9cb5364169c9e74f4f2a91554b)The only breaking change is a behavioral one, all programs should still compile without modification. The automatic GZIP decoding could interfere in cases where a user was expecting the GZIP bytes, either to save to a file or decode themselves. To restore this functionality, set client.gzip(false)
.
Response.json()
method (https://github.com/seanmonstar/reqwest/commit/2d10ecc99e2aaed66616294baaf65380b446e1c6)RedirectPolicy
(https://github.com/seanmonstar/reqwest/commit/e92b3e862a1a94c0b4173a7d49a315bc121da31e)Accept: */*
header by default if no Accept
header is set (https://github.com/seanmonstar/reqwest/commit/559ae8011a2c098f4fe1821ec1d3444a46f4bf5e)Sync
for Client
, and Send
for RequestBuilder
and Response
(https://github.com/seanmonstar/reqwest/commit/d18a53b3fcc81c4a60875755c8e95d777a343319)Send
for Error
(https://github.com/seanmonstar/reqwest/commit/20b161096e67d22c962e69b2656ae9741ac73c25)std::fmt::Debug
for all public types (https://github.com/seanmonstar/reqwest/commit/d624b0ef29020c6085ec94651a990f58ccd684e2)Error::Serialize
now has a Box<StdError + Send + Sync>
instead of Box<StdError>
RequestBuilder
no longer has an associated lifetime (was RequestBuilder<'a>
)Initial release: http://seanmonstar.com/post/153221119046/introducing-reqwest