Skip to content

Commit

Permalink
Add unboxing to JSON encoding to send scalers instead of lists, see #3
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollinsacis committed May 18, 2015
1 parent b694cb5 commit 700640f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/base.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,16 @@ idig_GET <- function(path, ...) {
##' @param ... additional arguments to be passed to httr::POST
##' @return the request (as a list)
##' @author Francois Michonneau
idig_POST <- function(path, body, encode="json", ...) {
idig_POST <- function(path, body, ...) {

stopifnot(inherits(body, "list"))
#stopifnot(exists("rq", body))


# Manually encode so we can use auto_unbox=TRUE, see ticket
# https://github.com/iDigBio/ridigbio/issues/3
json <- jsonlite::toJSON(body, auto_unbox=TRUE)
req <- httr::POST(idig_url(), path=paste(idig_version(), path, sep="/"),
body=body, encode=encode, ...)
body=json, ...)
idig_check(req)

req
Expand Down

0 comments on commit 700640f

Please sign in to comment.