resty v3.0.0-beta.4 版本更新介绍
发布日期: 2025-11-23
版本号: v3.0.0-beta.4
go-resty/resty 发布了 v3.0.0-beta.4 版本。本次更新包含一系列错误修复、功能增强和文档改进。主要修复了追踪信息计算、JSON解码函数返回、熔断器竞态条件、Client.Clone方法中的Cookie克隆、SSE回调中调用Close、设置超时导致的追踪时间负值计算,以及未解析响应时缺少流程检查等问题。新功能方面,增加了关闭钩子、为满足FIPS合规性使用SHA256替代MD5、并在TransportSettings中添加了MaxConnsPerHost设置。同时更新了CI配置,修正了文档和测试中的错误,并欢迎了六位新的代码贡献者。
更新内容 (中文)
v3 测试版发布
v3 升级指南
https://resty.dev/docs/upgrading-to-v3/
新功能与增强
https://resty.dev/docs/new-features-and-enhancements/
错误修复
- 修复:当请求无效时,追踪信息中可能出现错误的总耗时 (#1016),由 @git-hulk 在 https://github.com/go-resty/resty/pull/1017 提交
- 修复:修复了 decodeJson 函数不返回值的问题。由 @Khachi-at 在 https://github.com/go-resty/resty/pull/1002 提交
- 修复(熔断器):通过原子操作保护对 lastFailureAt 的访问以避免竞态条件,由 @liuzengh 在 https://github.com/go-resty/resty/pull/1019 提交
- 修复:修复 Client.Clone() 中的 Cookie 克隆问题,由 @jackcipher 在 https://github.com/go-resty/resty/pull/1036 提交
- 修复:能够在 SSE 回调中调用 Close,由 @invzhi 在 https://github.com/go-resty/resty/pull/1048 提交
- 修复:使用 SetTimeout 时出现负值追踪时间的问题,由 @nicolasbeauvais 在 https://github.com/go-resty/resty/pull/1038 提交
- 修复:补充缺失的流程并检查以不解析响应 #1051,由 @jeevatkm 在 https://github.com/go-resty/resty/pull/1068 提交
功能与增强
- 新功能:添加关闭钩子,由 @pior 在 https://github.com/go-resty/resty/pull/1054 提交
- 新功能(增强):使用 crypto/sha256 替代 crypto/md5 以符合 FIPS 标准。由 @BillBuilt 在 https://github.com/go-resty/resty/pull/1056 提交
- 新功能(增强):在 TransportSettings 中添加 MaxConnsPerHost 设置 #1058,由 @jeevatkm 在 https://github.com/go-resty/resty/pull/1069 提交
- 文档:修正注释中的代码语法,由 @invzhi 在 https://github.com/go-resty/resty/pull/1049 提交
- CI:更新 go.mod 包和构建配置,由 @jeevatkm 在 https://github.com/go-resty/resty/pull/1067 提交
- 发布:版本更新和说明文档更新,由 @jeevatkm 在 https://github.com/go-resty/resty/pull/1070 提交
测试
- 测试:添加带追踪的 HTTPS 请求测试以提高覆盖率,由 @nicolasbeauvais 在 https://github.com/go-resty/resty/pull/1064 提交
- 杂项:修复测试中的拼写错误,由 @alexandear 在 https://github.com/go-resty/resty/pull/1063 提交
新贡献者
- @Khachi-at 在 https://github.com/go-resty/resty/pull/1002 中完成了他们的首次贡献
- @jackcipher 在 https://github.com/go-resty/resty/pull/1036 中完成了他们的首次贡献
- @invzhi 在 https://github.com/go-resty/resty/pull/1049 中完成了他们的首次贡献
- @pior 在 https://github.com/go-resty/resty/pull/1054 中完成了他们的首次贡献
- @BillBuilt 在 https://github.com/go-resty/resty/pull/1056 中完成了他们的首次贡献
- @alexandear 在 https://github.com/go-resty/resty/pull/1063 中完成了他们的首次贡献
完整更新日志:https://github.com/go-resty/resty/compare/v3.0.0-beta.3…v3.0.0-beta.4
更新内容 (原始)
v3 Beta Release
v3 Upgrade Guide
https://resty.dev/docs/upgrading-to-v3/
New Features and Enhancements
https://resty.dev/docs/new-features-and-enhancements/
Bug Fixes
- fix: potential wrong total time in trace info when the request is invalid (#1016) by @git-hulk in https://github.com/go-resty/resty/pull/1017
- fix: Fixed functions of decodeJson do not return. by @Khachi-at in https://github.com/go-resty/resty/pull/1002
- fix(circuit breaker): protect access to lastFailureAt by atomic operations to avoid race conditions by @liuzengh in https://github.com/go-resty/resty/pull/1019
- fix: Cookie Clone Issue in Client.Clone() by @jackcipher in https://github.com/go-resty/resty/pull/1036
- fix: be able to invoke Close in SSE callback by @invzhi in https://github.com/go-resty/resty/pull/1048
- fix: negative trace substraction when using SetTimeout by @nicolasbeauvais in https://github.com/go-resty/resty/pull/1038
- fix: add missing flow and check for do not parse response #1051 by @jeevatkm in https://github.com/go-resty/resty/pull/1068
Features & Enhancements
- feat: Add close hooks by @pior in https://github.com/go-resty/resty/pull/1054
- feat(enhancement): Use crypto/sha256 instead of crypto/md5 for FIPS compliance. by @BillBuilt in https://github.com/go-resty/resty/pull/1056
- feat(enhancement): add MaxConnsPerHost setting into TransportSettings #1058 by @jeevatkm in https://github.com/go-resty/resty/pull/1069
- docs: correct code grammar in comments by @invzhi in https://github.com/go-resty/resty/pull/1049
- ci: update go.mod package and build config by @jeevatkm in https://github.com/go-resty/resty/pull/1067
- release: version bump and readme update by @jeevatkm in https://github.com/go-resty/resty/pull/1070
Tests
- test: Add HTTPS request with trace test for coverage by @nicolasbeauvais in https://github.com/go-resty/resty/pull/1064
- chore: fix typos in tests by @alexandear in https://github.com/go-resty/resty/pull/1063
New Contributors
- @Khachi-at made their first contribution in https://github.com/go-resty/resty/pull/1002
- @jackcipher made their first contribution in https://github.com/go-resty/resty/pull/1036
- @invzhi made their first contribution in https://github.com/go-resty/resty/pull/1049
- @pior made their first contribution in https://github.com/go-resty/resty/pull/1054
- @BillBuilt made their first contribution in https://github.com/go-resty/resty/pull/1056
- @alexandear made their first contribution in https://github.com/go-resty/resty/pull/1063
Full Changelog: https://github.com/go-resty/resty/compare/v3.0.0-beta.3...v3.0.0-beta.4