We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19d57be commit da2724aCopy full SHA for da2724a
NEWS.md
@@ -1,5 +1,7 @@
1
# httr2 (development version)
2
3
+* `req_url_query()` now re-calculates n lengths when using `.multi = "explode"` to avoid select/recycling issues (@Kevanness, #719).
4
+
5
# httr2 1.1.2
6
7
* `req_headers()` more carefully checks its input types (#707).
R/utils-multi.R
@@ -64,13 +64,7 @@ multi_dots <- function(
64
dots[n > 1] <- lapply(dots[n > 1], I)
65
} else if (.multi == "explode") {
66
dots <- explode(dots)
67
- dots[n > 1] <- imap(
68
- dots[n > 1],
69
- format_query_param,
70
- multi = TRUE,
71
- form = form
72
- )
73
- dots[n > 1] <- lapply(dots[n > 1], I)
+ n <- lengths(dots)
74
} else if (.multi == "error") {
75
cli::cli_abort(
76
c(
tests/testthat/test-utils-multi.R
@@ -17,6 +17,25 @@ test_that("can handle multi query params", {
17
)
18
})
19
20
+test_that("can handle mixed length multi query params", {
21
+ expect_equal(
22
+ multi_dots(a = 1:2, b = 1, c = NULL, .multi = "explode"),
23
+ list(a = I("1"), a = I("2"), b = I("1"), c = NULL)
24
+ )
25
26
+ multi_dots(a = 1:2, b = 1, c = NULL, .multi = "comma"),
27
+ list(a = I("1,2"), b = I("1"), c = NULL)
28
29
30
+ multi_dots(a = 1:2, b = 1, c = NULL, .multi = "pipe"),
31
+ list(a = I("1|2"), b = I("1"), c = NULL)
32
33
34
+ multi_dots(a = 1:2, b = 1, c = NULL, .multi = function(x) "X"),
35
+ list(a = I("X"), b = I("1"), c = NULL)
36
37
+})
38
39
test_that("can opt-out of escaping for' vectors", {
40
expect_equal(
41
multi_dots(a = I(c(" ", " ")), .multi = "comma"),
0 commit comments