diff --git a/R/render-har.r b/R/render-har.r index eac1693..34fa1d9 100644 --- a/R/render-har.r +++ b/R/render-har.r @@ -40,7 +40,7 @@ render_har <- function(splash_obj = splash_local, url, base_url, response_body=F res <- httr::GET(splash_url(splash_obj), path="render.har", encode="json", query=params) } else { res <- httr::GET( - splash_url(splash_obj), path="render.html", encode="json", query=params, + splash_url(splash_obj), path="render.har", encode="json", query=params, httr::authenticate(splash_obj$user, splash_obj$pass) ) } diff --git a/R/render-jpg.r b/R/render-jpg.r index cd73a12..88efc15 100644 --- a/R/render-jpg.r +++ b/R/render-jpg.r @@ -46,7 +46,7 @@ render_jpeg <- render_jpg <- function( res <- httr::GET(splash_url(splash_obj), path="render.jpeg", encode="json", query=params) } else { res <- httr::GET( - splash_url(splash_obj), path="render.html", encode="json", query=params, + splash_url(splash_obj), path="render.jpeg", encode="json", query=params, httr::authenticate(splash_obj$user, splash_obj$pass) ) } diff --git a/R/render-json.r b/R/render-json.r index 7e91bbf..f21b827 100644 --- a/R/render-json.r +++ b/R/render-json.r @@ -64,7 +64,14 @@ render_json <- function(splash_obj = splash_local, url, base_url=NULL, quality=7 if (!missing(save_args)) params$save_args <- jsonlite::unbox(save_args) if (!missing(load_args)) params$load_args <- jsonlite::unbox(load_args) - res <- httr::GET(splash_url(splash_obj), path="render.json", encode="json", query=params) + if (is.null(splash_obj$user)) { + res <- httr::GET(splash_url(splash_obj), path="render.json", encode="json", query=params) + } else { + res <- httr::GET( + splash_url(splash_obj), path="render.json", encode="json", query=params, + httr::authenticate(splash_obj$user, splash_obj$pass) + ) + } httr::stop_for_status(res) diff --git a/R/render-png.r b/R/render-png.r index 8d9af81..ec54f24 100644 --- a/R/render-png.r +++ b/R/render-png.r @@ -51,7 +51,7 @@ render_png <- function( res <- httr::GET(splash_url(splash_obj), path="render.png", encode="json", query=params) } else { res <- httr::GET( - splash_url(splash_obj), path="render.html", encode="json", query=params, + splash_url(splash_obj), path="render.png", encode="json", query=params, httr::authenticate(splash_obj$user, splash_obj$pass) ) } diff --git a/README.Rmd b/README.Rmd index 6f644ad..486a523 100644 --- a/README.Rmd +++ b/README.Rmd @@ -119,6 +119,8 @@ Suggest more in a feature req! ### Installation ```{r eval=FALSE} +devtools::install_git("https://gitlab.com/hrbrmstr/splashr.git") +# or devtools::install_github("hrbrmstr/splashr") ```