1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

clean up migration guide

This commit is contained in:
Rob Ede 2022-02-04 18:22:38 +00:00
parent 5ca42df89a
commit b4d3c2394d
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -29,13 +29,13 @@ Lots of modules has been organized in this release. If a compile error refers to
The default `NormalizePath` behavior now strips trailing slashes by default. This was previously documented to be the case in v3 but the behavior now matches. The effect is that routes defined with trailing slashes will become inaccessible when using `NormalizePath::default()`. As such, calling `NormalizePath::default()` will log a warning. It is advised that the `new` or `trim` methods be used instead. The default `NormalizePath` behavior now strips trailing slashes by default. This was previously documented to be the case in v3 but the behavior now matches. The effect is that routes defined with trailing slashes will become inaccessible when using `NormalizePath::default()`. As such, calling `NormalizePath::default()` will log a warning. It is advised that the `new` or `trim` methods be used instead.
```diff ```diff
- #[get("/test/")]` - #[get("/test/")]
+ #[get("/test")]` + #[get("/test")]
async fn handler() { async fn handler() {
App::new() App::new()
- .wrap(NormalizePath::default())` - .wrap(NormalizePath::default())
+ .wrap(NormalizePath::trim())` + .wrap(NormalizePath::trim())
``` ```
Alternatively, explicitly require trailing slashes: `NormalizePath::new(TrailingSlash::Always)`. Alternatively, explicitly require trailing slashes: `NormalizePath::new(TrailingSlash::Always)`.
@ -46,7 +46,7 @@ The associated type `Config` of `FromRequest` was removed. If you have custom ex
```diff ```diff
impl FromRequest for MyExtractor { impl FromRequest for MyExtractor {
- `type Config = ();` - type Config = ();
} }
``` ```