gpt4 book ai didi

java - 增加 swagger requestTimeout

转载 作者:行者123 更新时间:2023-12-02 05:00:07 25 4
gpt4 key购买 nike

有没有办法可以帮助我增加使用 swagger 的“尝试一下”向 RestAPI 发出的 swagger 请求的超时时间?

我在互联网上漫游,没有找到有用的东西,我尝试将一些东西添加到我的 yml conf 文件中,但我不知道该写什么

我希望找到这样的东西:

swagger.timeout=5000

我有一个使用 swagger 的 Spring Boot 应用程序,以便在 RestController 中测试我的 Web 服务。我有一个大约需要 30 秒的处理,这使得 swagger 为我抛出 500 超时错误。

谢谢!

最佳答案

据我所知,Swagger 将其端点注册为普通 Spring Controller ,因此使用底层 Web 容器来为其流量提供服务。

尝试增加全局连接超时:

server.connection-timeout=120000

Time that connectors wait for another HTTP request before closing the connection. When not set, the connector's container-specific default is used. Use a value of -1 to indicate no (that is, an infinite) timeout.

关于java - 增加 swagger requestTimeout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56391127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com