go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

maxBytes invalid

Open xiaoge200 opened this issue 1 year ago • 2 comments

Describe the bug "In the API file, I set maxBytes for the router group to 1,368,709,120, but after generating the code and running it, the actual maxBytes is still the default value."

  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


**Environments (please complete the following information):**
- OS: [e.g. Windows]
- go-zero version [e.g. 1.7.2]
- goctl version [e.g. 1.7.2, optional]

xiaoge200 avatar Oct 11 '24 10:10 xiaoge200

Can't reproduce your problem, from the generated code there seems to be no problem, can you provide the api file?

zhoushuguang avatar Oct 14 '24 01:10 zhoushuguang

It's already solved because I added the prefix prefix

xiaoge200 avatar Oct 15 '24 03:10 xiaoge200