zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.34k stars 3.96k forks source link

api路由中设置maxBytes不生效 #4418

Closed strong-xiaoge closed 1 month ago

strong-xiaoge commented 1 month ago

Describe the bug 在api文件中给路由组设置了maxBytes为1368709120,生成代码后实际运行的maxBytes还是默认值,没有生效

  1. The code is

    server.AddRoutes(
      []rest.Route{
          {
              Method:  http.MethodPost,
              Path:    "/xxx/xxx",
              Handler: aioxiekang.Upload(serverCtx),
          },
      },
      rest.WithPrefix("/xxx/xxx"),
      rest.WithMaxBytes(1368709120),
    )
    
  2. The error is

    request entity too large, limit is 1048576, but got 1448382, rejected with code 413

Expected behavior 请求成功,正常返回

Environments (please complete the following information):