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
with_mock_api fails to handle httr::rerequest() #84
Comments
Hmm, so when you load a mock response, there was no actual request made, so there is no Also, in the default case, when you record a mock, the response headers aren't kept, only the response body, so there are no Cache-Control headers in the mock response when it is loaded, so you're always in the reperform path, which leads to the error. You can solve this by recording mocks with What behavior exactly are you trying to test? |
Oh apologies; my test case wasn't clear. I don't need to test the caching/rerequest behavior using with_mock_api (I can manually check that logic with mockery if I really want to); I'm most worried about the dozens of existing tests that worked with httr::request but are failing with httr::rerequest. Ideally with_mock_api would treat httr::rerequest just like httr::request, or in other words, the mocked request from httr::request would be one without cache-control headers, rerequest would do the reperform, but with_mock_api would intercept it so that you'd get another mocked request. |
Got it. It sounds like if the function that loaded the mock were to include a curl handle, Would you be interested in submitting a PR to add this? |
I'm working on adding
Cache-Control
handling to a library I test usinghttptest
, and to my dismay, it seems thatwith_mock_api
doesn't handlehttr::rerequest
calls. Is rerequest support planned any time soon?Example:
The text was updated successfully, but these errors were encountered: