Skip to content

Commit

Permalink
#112 re-export as.character.form_file - needed for upload to work
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Aug 2, 2019
1 parent 697c683 commit 09282b4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(as.character,form_file)
S3method(ok,HttpClient)
S3method(ok,character)
S3method(ok,default)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ crul 0.8.4

### MINOR IMPROVEMENTS

* no longer exporting `as.character.form_file` - avoids conflict with `httr` function of the same name (#112)
* `jsonlite` package moved to Imports (#112)
* the `parse()` method in the `HttpResponse` object now checks whether the response raw bytes can be converted to character, and if not just returns raw bytes (#115) (#116)
* give vignettes titles (#113) (#114)

Expand Down
1 change: 1 addition & 0 deletions R/upload.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ upload <- function(path, type = NULL) {
curl::form_file(path, type)
}

#' @export
as.character.form_file <- function(x, ...) x
6 changes: 2 additions & 4 deletions tests/testthat/test-client-post.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ test_that("post request with file upload", {
expect_is(aa$content, "raw")
expect_null(aa$request$options$readfunction)
out <- jsonlite::fromJSON(aa$parse("UTF-8"))
# FIXME: since v0.8.4 these two tests are failing only on linux
# non-interactively, not sure why
# expect_named(out$files, "a")
# expect_match(out$files$a, "bibentry")
expect_named(out$files, "a")
expect_match(out$files$a, "bibentry")

## as data
aa2 <- cli$post("post", body = file)
Expand Down
6 changes: 2 additions & 4 deletions tests/testthat/test-retry.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,8 @@ test_that("retry wrapping post request with file upload", {
expect_is(aa2$request$options$readfunction, "function")
out <- jsonlite::fromJSON(aa2$parse("UTF-8"))
expect_equal(length(out$files), 0)
# FIXME: since v0.8.4 these two tests are failing only on linux
# non-interactively, not sure why
# expect_is(out$data, "character")
# expect_match(out$data, "bibentry")
expect_is(out$data, "character")
expect_match(out$data, "bibentry")


# binary file: jpeg
Expand Down

0 comments on commit 09282b4

Please sign in to comment.