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
Retries #31
Comments
Thanks for raising the issue! We don't support it yet. There's two things we need i think.
|
cool, am excited for it to be supported in the future! should I close this issue or let it open to remember to write an example or something? |
can leave it open i think for now, will label it a use case, then we can include as an example |
Re-visiting ropenaq tests, I'm very interested in this. |
okay, will bump this up in the priority list |
When this works won't it be easier to test the "retry" method in crul? 🙂 |
yes, good point |
@maelle okay, we have support for multiple responses now - the library(webmockr)
enable()
stub_request("get", "https://httpbin.org/get") %>%
to_return(status = 429, body = "retry!", times = 3) %>%
to_return(status = 200, body = "yay, success!")
res <- crul::HttpClient$new("https://httpbin.org/get")$retry("get", verbose = TRUE)
res$parse("UTF-8") |
That's really nice. I was thinking about using this for ropenaq tests but in ropenaq I use the crul retry method for non async and hope that there will be a crul retry method for async. This way no need for me to test for that in ropenaq... I'll try to make a PR to add a test to crul. |
mmmh actually I also add a test to ropenaq. ropensci-archive/ropenaq#55 |
Related to #4 (comment)
How would one test for the case when the API returns 429 say 3 times and then 200? How could I stub that in a test?
The text was updated successfully, but these errors were encountered: