You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+88Lines changed: 88 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,94 @@ and this project adheres to [Semantic Versioning](https://book.async.rs/overview
7
7
8
8
## [Unreleased]
9
9
10
+
## [2.0.0-alpha.5] - 2020-09-07
11
+
12
+
This is an alpha release in preparation of 2.0.0, so you can start using Surf with stable futures. There may be significant breaking changes before the final 2.0 release. Until thin, we recommend pinning to the particular alpha:
13
+
14
+
```toml
15
+
[dependencies]
16
+
surf = "= 2.0.0-alpha.5"
17
+
```
18
+
19
+
This alpha release notably contains much more API parity with Tide, particularly for `surf::Request`, `surf::Response`, and `surf::middleware::Middleware`. Middleware also is now implemented using [async-trait](https://crates.io/crates/async-trait). Additionally, `surf::Client` is no longer generic and now instead holds the internal `HttpClient` as a dynamic trait object.
20
+
21
+
These changes mean that surf middleware must undergo the following changes:
This alpha release also contains large changes to how the `surf::Request` and `surf::Client` APIs are structured, adding a `surf::RequestBuilder` which is now returned from methods such as `surf::get(...)`. Overall usage structure was kept the same where possible and reasonable, however now a `surf::Client` must be used when using middleware.
55
+
56
+
```rust
57
+
letclient=surf::client()
58
+
.with(some_middleware);
59
+
60
+
letreq=surf::post(url) // Now returns a `surf::RequestBuilder`!
61
+
.header(a_header, a_value)
62
+
.body(a_body);
63
+
letres=client.send(req).await?;
64
+
```
65
+
66
+
# Additions
67
+
-`surf::Request` added many methods that exist in `tide::Request`.
68
+
-`surf::Response` added many methods that exist in `tide::Response`.
69
+
-`surf::http`, an export of `http_types`, similar to `tide::http`.
70
+
-`surf::middleware::Redirect`, a middleware to handle redirect status codes.
71
+
- All conversions for `Request` and `Response` between `http_types` and `surf` now exist.
72
+
73
+
# Changes
74
+
-`surf::Request` changed many methods to be like those in `tide::Request`.
75
+
-`surf::Response` changed many methods to be like those in `tide::Response`.
76
+
- Surf now uses `http-types::mime` instead of the `mime` crate.
77
+
-`TryFrom<http_types::Request> for Request` is now `From<http_types::Request> for Request`.
78
+
-`surf::Client` is no longer generic for `C: HttpClient`.
79
+
- Middleware now receives `surf::Request` and returns `Result<surf::Response, E>`, and no longer requires a generic bound.
80
+
- Middleware now uses [async-trait](https://crates.io/crates/async-trait), which is exported as `surf::utils::async_trait`.
81
+
- The logger middleware is now exported as `surf::middleware::Logger`. (Note: this middleware is used by default.)
82
+
-`surf::{method}()` e.g. `surf::get()` now returns a `surf::RequestBuilder` rather than a `surf::Request`.
83
+
- Middleware can no longer be set for individual requests.
84
+
- Instead, use a `surf::Client` and register middleware via `client.with(middleware)`.
85
+
- Then, send the request from that client via `client.send()` e.g. `let res = client.send(request).await?;`.
86
+
-`surf::Client` now can set a "base url" for that client via `client.set_base_url()`.
87
+
88
+
# Fixes
89
+
-`From<http_types::Request> for Request` now properly propagates all properties.
90
+
- A cloned `surf::Client` no longer adds middleware onto its ancestor's middleware stack.
91
+
- Some feature flags are now correct.
92
+
93
+
# Internal
94
+
- Use Clippy in CI.
95
+
- Improved examples.
96
+
- Now only depends on `futures_util` rather than all of `futures`.
97
+
10
98
## [2.0.0-alpha.2] - 2020-04-29
11
99
12
100
This is an alpha release in preparation of 2.0.0, so you can start using Surf with stable `futures`. There may be significant breaking changes before the final 2.0 release. Until then, we recommend pinning to the particular alpha:
0 commit comments