Skip to content

Commit

Permalink
Merge pull request #47 from Public-Health-Scotland/edit-httr-retry
Browse files Browse the repository at this point in the history
don't retry on 409 status
  • Loading branch information
Moohan authored Nov 19, 2024
2 parents 3898526 + d8a4263 commit 759e371
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/phs_GET.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ phs_GET <- function(action, query, verbose = FALSE) {
response <- httr::RETRY(
verb = "GET",
url = url,
terminate_on = c(409),
user_agent = httr::user_agent(
"https://github.com/Public-Health-Scotland/phsmethods"
"phsopendata (https://github.com/Public-Health-Scotland/phsopendata)"
)
)

Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-get_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ test_that("get_dataset errors properly", {
regexp = "Did you mean .+?gp-practice-populations.+?\\?"
)
})

test_that("get_dataset filters error properly", {
expect_error(get_dataset("gp-practice-populations", col_select = "Non-existent column"),
regexp = "API error"
)
})

0 comments on commit 759e371

Please sign in to comment.