From 700640fc72d5f9e6adc6361b98972e28895627e1 Mon Sep 17 00:00:00 2001 From: Matthew Collins Date: Mon, 18 May 2015 15:30:14 -0400 Subject: [PATCH] Add unboxing to JSON encoding to send scalers instead of lists, see https://github.com/iDigBio/ridigbio/issues/3 --- R/base.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/R/base.R b/R/base.R index 1ad81ff..bb3a679 100644 --- a/R/base.R +++ b/R/base.R @@ -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