[Support] request entity too large #3969
-
Describe the problem(描述问题)目前使用midway/koa框架,在axios上传表单数据时显示PayloadTooLargeError: request entity too large 在issue中找到v2相关方案,不适用。 发送相关代码: axios.default.post('http://localhost:7001/api/ints/create', formData, {
headers: {
'Content-Type': 'x-www-form-urlencoded', //改完form-data也一样报错
},
})
src/config/config.default.ts
```ts
import { MidwayConfig } from '@midwayjs/core';
export default {
// use for cookie sign key, should change to your own and keep security
keys: '1721541900602_496',
cors: {
origin: '*',
},
koa: {
port: 7001,
},
bodyParser: {
enableTypes: ['json', 'form', 'text'],
formLimit: '50mb',
jsonLimit: '50mb',
textLimit: '50mb',
},
} as MidwayConfig;
观察发现修改limit前后报错中的“limit: 10485760”始终没有改变
### Midway Versions(Midway 版本)
Start to check your midway component version...
✓ @midwayjs/faas-typings(not installed)
✓ @midwayjs/fc-starter(not installed)
✓ @midwayjs/serverless-http-parser(not installed)
✓ @midwayjs/async-hooks-context-manager(3.16.2)
✓ @midwayjs/axios(not installed)
✓ @midwayjs/bootstrap(3.16.2)
✓ @midwayjs/bull(not installed)
✓ @midwayjs/bull-board(not installed)
✓ @midwayjs/cache-manager(not installed)
✓ @midwayjs/captcha(not installed)
✓ @midwayjs/casbin(not installed)
✓ @midwayjs/casbin-redis-adapter(not installed)
✓ @midwayjs/casbin-typeorm-adapter(not installed)
✓ @midwayjs/code-dye(not installed)
✓ @midwayjs/consul(not installed)
✓ @midwayjs/core(3.16.2)
✓ @midwayjs/cos(not installed)
✓ @midwayjs/cron(not installed)
✓ @midwayjs/cross-domain(3.16.5)
✓ @midwayjs/decorator(not installed)
✓ @midwayjs/etcd(not installed)
✓ @midwayjs/express-session(3.16.5)
✓ @midwayjs/faas(not installed)
✓ @midwayjs/grpc(not installed)
✓ @midwayjs/http-proxy(not installed)
✓ @midwayjs/i18n(3.16.5)
✓ @midwayjs/info(3.16.5)
✓ @midwayjs/jwt(not installed)
✓ @midwayjs/kafka(not installed)
✓ @midwayjs/leoric(not installed)
✓ @midwayjs/mikro(not installed)
✓ @midwayjs/mock(3.16.5)
✓ @midwayjs/mongoose(not installed)
✓ @midwayjs/mqtt(not installed)
✓ @midwayjs/oss(not installed)
✓ @midwayjs/otel(not installed)
✓ @midwayjs/passport(not installed)
✓ @midwayjs/process-agent(not installed)
✓ @midwayjs/prometheus(not installed)
✓ @midwayjs/prometheus-socket-io(not installed)
✓ @midwayjs/rabbitmq(not installed)
✓ @midwayjs/redis(not installed)
✓ @midwayjs/security(not installed)
✓ @midwayjs/sequelize(not installed)
✓ @midwayjs/session(3.16.5)
✓ @midwayjs/socketio(not installed)
✓ @midwayjs/static-file(not installed)
✓ @midwayjs/swagger(not installed)
✓ @midwayjs/tablestore(not installed)
✓ @midwayjs/tags(not installed)
✓ @midwayjs/tenant(not installed)
✓ @midwayjs/typegoose(not installed)
✓ @midwayjs/typeorm(not installed)
✓ @midwayjs/upload(3.16.5)
✓ @midwayjs/validate(3.16.5)
✓ @midwayjs/version(not installed)
✓ @midwayjs/view(not installed)
✓ @midwayjs/view-ejs(not installed)
✓ @midwayjs/view-nunjucks(not installed)
✓ @midwayjs/web(not installed)
✓ @midwayjs/express(3.16.5)
✓ @midwayjs/koa(3.16.5)
✓ @midwayjs/ws(not installed)
**********************************************************************
>> Check complete, all versions are healthy.
********************************************************************** |
Beta Was this translation helpful? Give feedback.
Answered by
czy88840616
Jul 25, 2024
Replies: 1 comment 1 reply
-
看着是上传的 10m,是这个配置?https://midwayjs.org/docs/extensions/upload#%E9%BB%98%E8%AE%A4%E9%85%8D%E7%BD%AE |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ISDHN
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
看着是上传的 10m,是这个配置?https://midwayjs.org/docs/extensions/upload#%E9%BB%98%E8%AE%A4%E9%85%8D%E7%BD%AE