-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VCR tests fail with longurl::expand_urls() #220
Comments
thanks! i'll have a look |
Thank you! I appreciate it |
i think i found the issue, need to do some more testing to make sure a fix doesn't break other thing |
…hange in webmockr - RequestMatcherRegistry register_$built_ins method needed fix in the rul for path: strip trailing slash first
i thought i had it fixed, but not working yet. problem is the redirects. we don't record the redirect for some reason |
library(curl)
h = new_handle()
handle_setopt(h, .list = list(customrequest = "HEAD", nobody = TRUE, followlocation = TRUE, verbose = TRUE))
res = curl_fetch_memory("http://bit.ly/2SfWO3K", h)
res not clear to me how Ruby vcr records all requests in a redirect chain if it behaves the same way as above in R |
We can record a redirect with httr or crul, but both error on the 2nd use of the cassette because the cassette only has 1 request/response - the final http request in the redirect chain - so subsequent library(crul)
con <- HttpClient$new("http://bit.ly/2SfWO3K")
use_cassette("crul_redirect_head", {
x <- con$head()
}) library(httr)
use_cassette("httr_redirect_head", {
x <- HEAD("http://bit.ly/2SfWO3K")
}) |
to dos
|
@bretsw Making progress now, work on branch |
- add set_handler() and add_redirect() methods to Cassette R6 class for dealing with redirects - fix record_separate_redirects usage in insert_cassette - change use_cassette() to use add_redirect - change RequestHandler to use set_handler
I moved this to the next milestone since a) this is complicated, and b) its not done yet, and c) there's lots of issues in the current milestone that should be pushed. b) major issue is the http response object is from the first chain in the redirect - NOT the last http response in the chain as it should be. I'm not sure how to fix this yet. |
Thanks @sckott! It's interesting how such a simple-seeming bug is turning out to be quite complicated to address. Thanks for sticking with this! |
It's an interesting one, thanks for opening the issue |
In a package I'm developing, tests for a function have been failing, and I traced the issue back to the source:
longurl::expand_urls()
As an example of functionality, running
longurl::expand_urls("http://bit.ly/2SfWO3K", seconds=10)$expanded_url)
returns"https://www.aect.org/about_us.php"
.However, putting this inside a vcr test fails, and it's unclear to me why.
Example
Session Info
The text was updated successfully, but these errors were encountered: