nealrichardson / httptest2

Utilities for testing R 📦s that use httr2
https://enpiar.com/httptest2/
Other
26 stars 6 forks source link

Check for body in the reponse before to read it #37

Closed jmaspons closed 2 months ago

jmaspons commented 2 months ago

If the response has no body, write and empty file FIX #35

nealrichardson commented 2 months ago

Thanks. This seems reasonable. Would you mind adding a test that covers this case?

jmaspons commented 2 months ago

Yes, I would like to add a test. Could you give me an example about how to simulate and empty response? I've seen that webfakes is used but I have no experience with it

nealrichardson commented 2 months ago

httr2::response() makes responses, and as it turns out, with no arguments specified, the body will be empty. So you could test that save_response() can write that to a tempfile, and probably should test that we can read it back in with load_response().

jmaspons commented 2 months ago

Tests added, @nealrichardson

jmaspons commented 2 months ago

Ready to merge, @nealrichardson