Skip to content

Commit

Permalink
swap info fxn over to use httr2
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Aug 9, 2024
1 parent ce8f9c3 commit 0d8f6ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 5 additions & 6 deletions R/info.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
#' - `commit_message` (character): the commit message of the API's most recent commit
#' - `tag` (character): tag of most recent commit; if this does not contain a hyphen, it's a release version
proof_info <- function() {
response <- GET(
make_url("info"),
timeout(proofr_env$timeout_sec)
)
stop_for_message(response)
content(response, as = "parsed")
request(make_url("info")) |>
req_timeout(proofr_env$timeout_sec) |>
req_error(body = error_body) |>
req_perform() |>
resp_body_json()
}

5 changes: 5 additions & 0 deletions tests/testthat/test-proof_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ test_that("proof_info - success", {

expect_type(info_res, "list")

# also works w/o token as it's not needed for this fxn
info_res_wo_token <- proof_info()

expect_type(info_res_wo_token, "list")


stub_registry_clear()
disable(quiet = TRUE)
Expand Down

0 comments on commit 0d8f6ea

Please sign in to comment.