Skip to content

Commit c73661e

Browse files
authored
Trim spaces when formatting vector of numbers (#355)
Fixes #354
1 parent adc3a62 commit c73661e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: R/url.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,6 @@ format_query_param <- function(x, error_call = caller_env()) {
200200
return(x)
201201
}
202202

203-
x <- format(x, scientific = FALSE)
203+
x <- format(x, scientific = FALSE, trim = TRUE)
204204
curl::curl_escape(x)
205205
}

Diff for: tests/testthat/test-url.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ test_that("handles all atomic vectors", {
8383
})
8484

8585

86-
test_that("doubles don't use scientific notation", {
86+
test_that("formats numbers nicely", {
8787
expect_equal(format_query_param(1e9), "1000000000")
88+
expect_equal(format_query_param(c(1, 1000)), c("1", "1000"))
8889
})
8990

9091
test_that("can opt out of escaping", {

0 commit comments

Comments
 (0)