-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't automatically unbox vectors when making requests.
When upgrading to httr2, I rewrote some of the http client code and forgot to keep the `auto_unbox = FALSE` flag. This has caused uploads to outpack_server to break, as requests were now malformed. The issue is that it is ambiguous whether `list(x = 1)` should be serialized as `{"x": 1}` or as `{"x": [ 1 ]}`, because R does not differentiate between scalar and vectors of length one. By default, httr2 applies `auto_unbox = TRUE`, which leads to all length 1 vectors being unboxed into a JSON scalar. By explictly choosing setting that flag to `FALSE`, we may override this behaviour and keep all vectors as vectors by default. Scalars need to be marked as such with the `scalar(x)` function (defined as `jsonlite::unbox(x)`). Frustratingly this did not get caught by our testsuite because we were always pushing more than one packet at a time. I've added a test for this particular case, pushing one packet and one file, to make sure regressions don't get introduced in the future.
- Loading branch information
Showing
5 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: orderly2 | ||
Title: Orderly Next Generation | ||
Version: 1.99.32 | ||
Version: 1.99.33 | ||
Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"), | ||
email = "[email protected]"), | ||
person("Robert", "Ashton", role = "aut"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters