parser_form {plumber}R Documentation

Plumber Parsers

Description

Parsers are used in Plumber to transform request body received by the API. Extra parameters may be provided to parser functions when enabling them on router. This will allow for non-default behavior.

Usage

parser_form()

parser_json(...)

parser_geojson(...)

parser_text(parse_fn = identity)

parser_yaml(...)

parser_csv(...)

parser_tsv(...)

parser_read_file(read_fn = readLines)

parser_rds(...)

parser_feather(...)

parser_parquet(...)

parser_octet()

parser_multi()

parser_none()

Arguments

...

parameters supplied to the appropriate internal function

parse_fn

function to further decode a text string into an object

read_fn

function used to read a the content of a file. Ex: readRDS()

Details

Parsers are optional. When unspecified, only default endpoint parsers are enabled. You can use ⁠@parser NAME⁠ tag to enable parser on endpoint. Multiple parsers can be enabled on the same endpoint using multiple ⁠@parser NAME⁠ tags.

User should be aware that rds parsing should only be done from a trusted source. Do not accept rds files blindly.

See registered_parsers() for a list of registered parsers names.

Functions

Examples

## Not run: 
# Overwrite `text/json` parsing behavior to not allow JSON vectors to be simplified
#* @parser json list(simplifyVector = FALSE)
# Activate `rds` parser in a multipart request
#* @parser multi
#* @parser rds
pr <- Plumber$new()
pr$handle("GET", "/upload", function(rds) {rds}, parsers = c("multi", "rds"))

## End(Not run)

[Package plumber version 1.2.2 Index]