We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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_dir
Thanks for httptest2! I'm using it to test https://github.com/jmaspons/osmapiR and I found an error (v. 1.0.0):
remotes::install_github("jmaspons/osmapiR") ## Sorry, I have no other calls at hand to reproduce the error httptest2::with_mock_dir("mock_set_prefs_user", r <- osmapiR::osm_set_preferences_user(key = "test-pref", value = "value")) #> Error in `resp_body_raw()`: #> ! Can't retrieve empty body. #> Run `rlang::last_trace()` to see where the error occurred. rlang::last_trace() #> <error/rlang_error> #> Error in `resp_body_raw()`: #> ! Can't retrieve empty body. #> --- #> Backtrace: #> ▆ #> 1. ├─httptest2::with_mock_dir(...) #> 2. │ ├─httptest2:::with_mock_path(...) #> 3. │ │ └─base::eval.parent(expr) #> 4. │ │ └─base::eval(expr, p) #> 5. │ └─httptest2::capture_requests(expr, simplify = simplify) #> 6. │ └─base::eval.parent(expr) #> 7. │ └─base::eval(expr, p) #> 8. ├─testthat::expect_null(...) #> 9. │ └─testthat::quasi_label(enquo(object), label, arg = "object") #> 10. │ └─rlang::eval_bare(expr, quo_get_env(quo)) #> 11. └─osmapiR::osm_set_preferences_user(key = "test-pref", value = "value") #> 12. └─httr2::req_perform(req) at osmapiR/R/osmapi_user_data.R:628:3 #> 13. ├─base::.doTrace(...) at osmapiR/R/osmapi_user_data.R:628:3 #> 14. │ └─base::eval.parent(exprObj) #> 15. │ └─base::eval(expr, p) #> 16. │ └─base::eval(expr, p) #> 17. └─httptest2::save_response(...) #> 18. └─httr2::resp_body_string(response) #> 19. └─httr2::resp_body_raw(resp) #> Run rlang::last_trace(drop = FALSE) to see 2 hidden frames.
I think it's missing a check for length(response$body) in
length(response$body)
httptest2/R/capture-requests.R
Line 128 in cff21ee
With simplify = FALSE it works because it has the check
simplify = FALSE
Line 155 in cff21ee
I can do a PR if you want.
The text was updated successfully, but these errors were encountered:
Sure, I think I see what you're saying. A PR would be appreciated, thanks!
Sorry, something went wrong.
Check for body in the reponse before to read it
9899125
If the response has no body, write and empty file FIX nealrichardson#35
245a90f
Successfully merging a pull request may close this issue.
Thanks for httptest2! I'm using it to test https://github.com/jmaspons/osmapiR and I found an error (v. 1.0.0):
I think it's missing a check for
length(response$body)
inhttptest2/R/capture-requests.R
Line 128 in cff21ee
With
simplify = FALSE
it works because it has the checkhttptest2/R/capture-requests.R
Line 155 in cff21ee
I can do a PR if you want.
The text was updated successfully, but these errors were encountered: