1context("echo")
2
3test_that("roundtrip large data", {
4  skip_if_not_installed('httpuv')
5  bindata <- serialize(rnorm(1e5), NULL)
6  input_url <- 'https://fakeserver.org:99/my/endpoint'
7  handle <- curl::new_handle(url = input_url)
8  handle_setheaders(handle, 'Foobar' = 'testtest')
9  curl::handle_setform(handle, data =  curl::form_data(bindata, "application/octet-stream"))
10  formdata <- curl::curl_echo(handle = handle)
11  expect_identical(formdata$url, input_url)
12  expect_identical(formdata$path, '/my/endpoint')
13  expect_identical(formdata$method, 'POST')
14  expect_identical(formdata$headers[['foobar']], 'testtest')
15  expect_identical(formdata$headers[['host']], "fakeserver.org:99")
16  out <- webutils::parse_http(formdata$body, formdata$content_type)
17  expect_identical(out$data$value, bindata)
18})
19