mirror of
https://github.com/actix/actix-web.git
synced 2024-12-22 08:07:18 +00:00
Merge branch 'master' of github.com:actix/actix-web
This commit is contained in:
commit
4ef46e26f9
1 changed files with 55 additions and 0 deletions
55
MIGRATION.md
55
MIGRATION.md
|
@ -1,3 +1,58 @@
|
||||||
|
## 1.0
|
||||||
|
|
||||||
|
* `State` is now `Data`. You register Data during the App initialization process
|
||||||
|
and then access it from handlers either using a Data extractor or using
|
||||||
|
HttpRequest's api.
|
||||||
|
|
||||||
|
instead of
|
||||||
|
|
||||||
|
```rust
|
||||||
|
App.with_state(T)
|
||||||
|
```
|
||||||
|
|
||||||
|
use App's `data` method
|
||||||
|
|
||||||
|
```rust
|
||||||
|
App.new()
|
||||||
|
.data(T)
|
||||||
|
```
|
||||||
|
|
||||||
|
and either use the Data extractor within your handler
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use actix_web::web::Data;
|
||||||
|
|
||||||
|
fn endpoint_handler(Data<T>)){
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
.. or access your Data element from the HttpRequest
|
||||||
|
|
||||||
|
```rust
|
||||||
|
fn endpoint_handler(req: HttpRequest) {
|
||||||
|
let data: Option<Data<T>> = req.app_data::<T>();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
* AsyncResponder is deprecated.
|
||||||
|
|
||||||
|
instead of
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use actix_web::AsyncResponder;
|
||||||
|
|
||||||
|
fn endpoint_handler(...) -> impl Future<Item=HttpResponse, Error=Error>{
|
||||||
|
...
|
||||||
|
.responder()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
.. simply omit AsyncResponder and the corresponding responder() finish method
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 0.7.15
|
## 0.7.15
|
||||||
|
|
||||||
* The `' '` character is not percent decoded anymore before matching routes. If you need to use it in
|
* The `' '` character is not percent decoded anymore before matching routes. If you need to use it in
|
||||||
|
|
Loading…
Reference in a new issue