@@ -7,6 +7,99 @@ and this project adheres to [Semantic Versioning](https://book.async.rs/overview
7
7
8
8
## [ Unreleased]
9
9
10
+ ## [ 0.6.0] - 2020-01-30
11
+
12
+ [ API Documentation] ( https://docs.rs/tide/0.6.0/tide )
13
+
14
+ This patch introduces a new cookies API, based on the excellent
15
+ [ cookie] ( https://docs.rs/cookie/ ) crate. Working with cookies is a staple for
16
+ any web server, and Tide's new API now makes this entirely declarative.
17
+
18
+ Additionally we've added back CORS support. This makes it possible for
19
+ possible to configure the single-origin policy of browsers, which is an
20
+ incredibly valuable resource.
21
+
22
+ And finally nesting services with Tide has become even easier. Building on
23
+ the APIs in 0.5.0, the manual song-and-dance required to nest APIs is no
24
+ longer required, and services can now be nested as-is through the
25
+ ` Route::nest ` API.
26
+
27
+ ### Examples
28
+
29
+ #### Cookies
30
+
31
+ ``` rust
32
+ use cookie :: Cookie ;
33
+ use tide :: Response ;
34
+
35
+ let mut app = tide :: new ();
36
+
37
+ app . at (" /" ). get (| req | async move {
38
+ println! (" cat snack: {:?}" , req . cookie (" snack" ));
39
+ Response :: new (200 )
40
+ });
41
+ app . at (" /set" ). get (| req | async move {
42
+ let mut res = Response :: new (200 );
43
+ res . set_cookie (Cookie :: new (" snack" , " tuna" ));
44
+ res
45
+ });
46
+ app . listen (" 127.0.0.1:8080" ). await ? ;
47
+ ```
48
+
49
+ #### CORS
50
+
51
+ Make GET, POST, and OPTIONS endpoints on this server accessible from any web
52
+ page.
53
+
54
+ ``` rust
55
+ use http :: header :: HeaderValue ;
56
+ use tide :: middleware :: {Cors , Origin };
57
+
58
+ let rules = Cors :: new ()
59
+ . allow_methods (HeaderValue :: from_static (" GET, POST, OPTIONS" ))
60
+ . allow_origin (Origin :: from (" *" ))
61
+ . allow_credentials (false );
62
+
63
+ let mut app = tide :: new ();
64
+ app . middleware (rules );
65
+ app . at (" /" ). post (| _ | async { Response :: new (200 ) });
66
+ app . listen (" localhost:8080" ). await ? ;
67
+ ```
68
+
69
+ #### Nesting
70
+
71
+ Nest the inner serve inside the outer service, exposing ` GET /nori/cat ` .
72
+
73
+ ``` rust
74
+ let mut inner = tide :: new ();
75
+ inner . at (" /nori" ). get (| _ | async { Response :: new (200 ) });
76
+
77
+ let mut outer = tide :: new ();
78
+ outer . at (" /cat" ). nest (inner );
79
+
80
+ outer . listen (" localhost:8080" ). await ? ;
81
+ ```
82
+
83
+ ### Added
84
+
85
+ - Added ` Route::all ` to match all HTTP methods on a route ([ #379 ] ( https://github.com/http-rs/tide/pull/379 ) )
86
+ - Added ` Route::nest ` to nest instances of ` tide::Server ` on sub-routes ([ #379 ] ( https://github.com/http-rs/tide/pull/379 ) )
87
+ - Added a new ` cors ` submodule containing CORS control middleware ([ #373 ] ( https://github.com/http-rs/tide/pull/373 ) )
88
+ - Added ` Request::cookie ` to get a cookie sent by the client ([ #380 ] ( https://github.com/http-rs/tide/pull/380/files ) )
89
+ - Added ` Response::set_cookie ` to instruct the client to set a cookie ([ #380 ] ( https://github.com/http-rs/tide/pull/380/files ) )
90
+ - Added ` Response::remove_cookie ` to instruct the client to unset a cookie ([ #380 ] ( https://github.com/http-rs/tide/pull/380/files ) )
91
+
92
+ ### Changed
93
+
94
+ - Changed the behavior of optional params in ` Request.query ` to be more intuitive ([ 384] ( https://github.com/http-rs/tide/pull/384 ) )
95
+ - Improved the debugging experience of query deserialization errors ([ 384] ( https://github.com/http-rs/tide/pull/384 ) )
96
+ - Updated the GraphQL example to use the latest version of Juniper ([ #372 ] ( https://github.com/http-rs/tide/pull/372 ) )
97
+ - Tide no longer prints to stdout when started ([ 387] ( https://github.com/http-rs/tide/pull/387 ) )
98
+
99
+ ### Fixed
100
+
101
+ - Fixed an incorrect MIME type definition on ` Response::body ` ([ 378] ( https://github.com/http-rs/tide/pull/378 ) )
102
+
10
103
## [ 0.5.1] - 2019-12-20
11
104
12
105
[ API Documentation] ( https://docs.rs/tide/0.5.1/tide )
@@ -191,7 +284,8 @@ Log not kept.
191
284
192
285
Log not kept.
193
286
194
- [ Unreleased ] : https://github.com/http-rs/tide/compare/0.5.1...HEAD
287
+ [ Unreleased ] : https://github.com/http-rs/tide/compare/0.6.0...HEAD
288
+ [ 0.6.0 ] : https://github.com/http-rs/tide/compare/0.5.1...0.6.0
195
289
[ 0.5.1 ] : https://github.com/http-rs/tide/compare/0.5.0...0.5.1
196
290
[ 0.5.0 ] : https://github.com/http-rs/tide/compare/0.4.0...0.5.0
197
291
[ 0.4.0 ] : https://github.com/http-rs/tide/compare/0.3.0...0.4.0
0 commit comments