Skip to content

Commit

Permalink
docs: fix volo http fallback (#1164)
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarisW authored Nov 4, 2024
1 parent c8f183e commit 484565a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions content/en/docs/volo/volo-http/tutorials/route.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,14 @@ async fn router() -> Router {

## Fallback

Volo-HTTP provides a fallback function to handle request url or method mismatches.
Volo-HTTP provides a fallback function to handle request url or method mismatches, **default fallback** will return status code `404 Not Found`.

### url
**Note**:
- Since there is no way to determine which **router fallback** to override in a route in a call to the `merge` method, only one **router fallback** can be set, or else a **panic** will be generated in the call to the `merge` method;

- The `nest` method is called without overriding the `fallback`.

> Note: Only one **router fallback** can be set globally, otherwise it will generate a **panic** when the `merge` method is called.
### url

**Example**:

Expand Down
9 changes: 6 additions & 3 deletions content/zh/docs/volo/volo-http/tutorials/route.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,14 @@ async fn router() -> Router {

## fallback

Volo-HTTP 提供了 fallback 功能用于处理请求 url 或 method 不匹配的情况
Volo-HTTP 提供了 fallback 功能用于处理请求 url 或 method 不匹配的情况**默认 fallback** 会返回状态码 `404 Not Found`

### url
**注意**
- 调用 `merge` 方法中的路由中由于不能确定覆盖哪一个 **router fallback**, 因此只能设置一个 **router fallback**,否则会在调用 `merge` 方法时产生 **panic**

- 调用 `nest` 方法时不会对 `fallback` 进行覆盖。

> 注意:全局只能设置一个 **router fallback**,否则会在调用 `merge` 方法时产生 **panic**
### url

**代码示例**:

Expand Down

0 comments on commit 484565a

Please sign in to comment.