dreamhead / moco

Easy Setup Stub Server
MIT License
4.35k stars 1.08k forks source link

请求超过10MB报错,有配置的地方吗 #332

Open weimo110 opened 1 year ago

weimo110 commented 1 year ago

18 8月 2023 17:14:38 [nioEventLoopGroup-3-2] ERROR Exception thrown io.netty.handler.codec.TooLongFrameException: HTTP content length exceeded 1048576 bytes. at io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:218) at io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:57) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:428) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:277) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:372) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:245) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:243) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:962) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:485) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:399) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:371) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) at java.base/java.lang.Thread.run(Thread.java:835)

dreamhead commented 1 year ago

HTTP body and header size can be set in Java API. You can provide your own ServerConfig to invoke createHttpServer method.

https://github.com/dreamhead/moco/blob/b26518ea28a6cb6967321411d177e02df0998600/moco-core/src/main/java/com/github/dreamhead/moco/internal/ActualHttpServer.java#L150

caiming0917 commented 11 months ago

以提供的 moco-runner-1.1.0-standalone.jar 包部署启动 mock ,能通过自定义配置文件配置请求体大小上限吗?

dreamhead commented 11 months ago

@caiming0917 Currently, no JSON API is provided.