[go: up one dir, main page]

File: MIGRATION-2.0.md

package info (click to toggle)
rust-actix-web 4.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,532 kB
  • sloc: makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,332 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Migrating to 2.0.0

- `HttpServer::start()` renamed to `HttpServer::run()`. It also possible to `.await` on `run` method result, in that case it awaits server exit.

- `App::register_data()` renamed to `App::app_data()` and accepts any type `T: 'static`. Stored data is available via `HttpRequest::app_data()` method at runtime.

- Extractor configuration must be registered with `App::app_data()` instead of `App::data()`

- Sync handlers has been removed. `.to_async()` method has been renamed to `.to()` replace `fn` with `async fn` to convert sync handler to async

- `actix_http_test::TestServer` moved to `actix_web::test` module. To start test server use `test::start()` or `test_start_with_config()` methods

- `ResponseError` trait has been refactored. `ResponseError::error_response()` renders http response.

- Feature `rust-tls` renamed to `rustls`

  instead of

  ```rust
  actix-web = { version = "2.0.0", features = ["rust-tls"] }
  ```

  use

  ```rust
  actix-web = { version = "2.0.0", features = ["rustls"] }
  ```

- Feature `ssl` renamed to `openssl`

  instead of

  ```rust
  actix-web = { version = "2.0.0", features = ["ssl"] }
  ```

  use

  ```rust
  actix-web = { version = "2.0.0", features = ["openssl"] }
  ```

- `Cors` builder now requires that you call `.finish()` to construct the middleware