升级Ruby 2.6至2.7-网络货物不再识别存根请求上的正则模式

发布于 2025-01-28 14:25:29 字数 456 浏览 2 评论 0原文

我正在将Rails 6.1.4升级为Ruby 2.6.10到Ruby 2.7.6。使用Ruby 2.7.6,网络货物不再匹配2.6.10中完美工作的正则表达式。

在两种情况下,我都使用了最新版本的Webmock Gem(3.14.0)以及Ruby 2.6.10和Ruby 2.7.6实现的最新版本。

比较Ruby 2.6.10在Ruby 2.7.6下创建的ub_requests,我没有看到差异。

我已经浏览了Ruby 2.7更改笔记,并且没有看到任何能给我任何可能影响的变化的迹象。

最初,我经历了这个问题,将Ruby 3.0.4升级为3.0.4,但进行了2.7.6的实验,并看到这是引入问题的地方。

透过好处,我没有看到任何看起来可能引起问题的东西。

当我用硬编码值替换正则文本时,会发现存根,但是这种有点杀死了使用正则态度的灵活性。

关于我可以在哪里可以找出为什么Regex不再工作的任何建议?

I am upgrading a Rails 6.1.4 application from Ruby 2.6.10 to Ruby 2.7.6. With Ruby 2.7.6, WebMock no longer matches the Regular Expressions that worked perfectly in 2.6.10.

I am using the latest version of the WebMock gem (3.14.0) in both cases, as well as the latest versions of the required gems, for both the Ruby 2.6.10 and the Ruby 2.7.6 implementations.

Comparing the stub_requests created under Ruby 2.6.10 those created under Ruby 2.7.6, I am seeing no differences.

I have looked through the Ruby 2.7 change notes and am not seeing anything that gives me any indication on what changed that could impact.

Originally, I had experienced this problem upgrading to Ruby 3.0.4, but experimented with 2.7.6 and see that this is where the problem appears to be introduced.

Looking through the Gemfile, I am not seeing anything that looks like it could be causing the problem.

When I replace the RegEx text with hard-coded values, the stubs are found, but this kinda kills the flexibility of using RegEx.

Any suggestions on where I could look to find out why RegEx is no longer working?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耶耶耶 2025-02-04 14:25:29

根本原因是标头在Ruby 2.6和2.7之间发生了变化,我必须更新预期的标头。

The root cause was that the headers has changed between Ruby 2.6 and 2.7 and I had to update the expected header.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文