curl_echo {curl} | R Documentation

## Echo Service

### Description

This function is only for testing purposes. It starts a local httpuv server to echo the request body and content type in the response.

### Usage

    curl_echo(handle, port = 9359, progress = interactive(), file = NULL)

### Arguments

`handle` | a curl handle object
`port` | the port number on which to run httpuv server
`progress` | show progress meter during http transfer
`file` | path or connection to write body. Default returns body as raw vector.

### Examples

    h <- handle_setform(new_handle(), foo = "blabla", bar = charToRaw("test"),
    myfile = form_file(system.file("DESCRIPTION"), "text/description"))
    formdata <- curl_echo(h)

    # Show the multipart body
    cat(rawToChar(formdata$body))

    # Parse multipart
    webutils::parse_http(formdata$body, formdata$content_type)

[Package curl version 3.2 Index]