gpt4 book ai didi

ruby-on-rails - vcr 不知道如何处理这个请求

转载 作者:行者123 更新时间:2023-12-04 03:45:17 26 4
gpt4 key购买 nike

嗨,我正在尝试使用带有标签的 vcr 用 cucumber 测试谷歌身份验证。

一切顺利,直到 token 过期。我想当它到期时会发生这种情况

enter image description here

但我有一个包含此内容的文件

http_interactions:
- request:
method: post
uri: https://accounts.google.com/o/oauth2/token
body:

如果我允许 vcr 记录新请求,则此卡带的内容会发生变化。我不明白为什么,如果方法和 uri 不将 POST 更改为 https://accounts.google.com/o/oauth2/token .

我更改了标签以录制新剧集,现在测试通过了......我一无所知。

我再次运行测试,现在我在 POST 到 token url 时遇到了这个问题:
Completed 500 Internal Server Error in 449ms

Psych::BadAlias (Unknown alias: 70317249293120):

最佳答案

也许你的帖子里面有一些参数,每个请求都不同?如果是这样,您可以通过添加 match_requests_on: [:method, VCR.request_matchers.uri_without_params("your_param")] 告诉 VCR 忽略此参数。到您的 VCR 配置。

深入分析您的请求,并找出哪些参数发生了变化。您可以告诉 VCR 也匹配其他条件,请看这里 https://www.relishapp.com/vcr/vcr/v/2-4-0/docs/request-matching

关于ruby-on-rails - vcr 不知道如何处理这个请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14885557/

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