Skip to content

Commit

Permalink
Explain normalization in auth test. (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonthegeek authored Jan 20, 2025
1 parent 43f1d14 commit 6bd6808
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/testthat/test-req_auth_api_key.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ test_that("req_auth_api_key works for query", {
api_key = "my_key",
location = "query"
)
# As of 2025-01-20, httr2 on macos did not insert the "/", but all other OSs
# did. Normalizing manually here.
# In httr2 <=1.0.7, path can be NULL. in 1.1.0+, path is normalized to at
# least "/". Normalize to make sure this test passes in both of those
# versions.
test_result$url <- stringr::str_replace(
test_result$url,
stringr::fixed("/?parm"),
stringr::fixed("?parm")
stringr::fixed("example.com?parm"),
stringr::fixed("example.com/?parm")
)
expect_identical(
test_result$url,
"https://example.com?parm=my_key"
"https://example.com/?parm=my_key"
)
})

Expand Down

0 comments on commit 6bd6808

Please sign in to comment.