Skip to contents

These functions cover a large area of potential request body formats. They are all registered to their standard mime types but users may want to use them to register them to alternative types if they know it makes sense.

Usage

parse_csv(...)

parse_octet()

parse_rds(...)

parse_feather(...)

parse_parquet(...)

parse_text(multiple = FALSE)

parse_tsv(...)

parse_yaml(...)

parse_geojson(...)

parse_multipart(parsers = get_parsers())

Arguments

...

Further argument passed on to the internal parsing function. See Details for information on which function handles the parsing internally in each parser

multiple

logical: should the conversion be to a single character string or multiple individual characters?

parsers

A list of parsers to use for parsing the parts of the body

Value

A function accepting a raw vector along with a directives argument that provides further directives from the Content-Type to be passed along

Provided parsers

  • parse_csv() uses readr::read_csv() for parsing. It is registered as "csv" for the mime types application/csv, application/x-csv, text/csv, and text/x-csv

  • parse_multipart uses webutils::parse_multipart() for the initial parsing. It then goes through each part and tries to find a parser that matches the content type (either given directly or guessed from the file extension provided). If a parser is not found it leaves the value as a raw vector. It is registered as "multi" for the mime type multipart/*

  • parse_octet() passes the raw data through unchanged. It is registered as "octet" for the mime type application/octet-stream

  • parse_rds() uses unserialize() for parsing. It is registered as "rds" for the mime type application/rds

  • parse_feather() uses arrow::read_feather() for parsing. It is registered as "feather" for the mime types application/vnd.apache.arrow.file and application/feather

  • parse_parquet() uses arrow::read_parquet() for parsing. It is registered as "parquet" for the mime type application/vnd.apache.parquet

  • parse_text() uses rawToChar() for parsing. It is registered as "text" for the mime types text/plain and text/*

  • parse_tsv() uses readr::read_tsv() for parsing. It is registered as "tsv" for the mime types application/tab-separated-values and text/tab-separated-values

  • parse_yaml() uses yaml::yaml.load() for parsing. It is registered as "yaml" for the mime types text/vnd.yaml, application/yaml, application/x-yaml, text/yaml, and text/x-yaml

  • parse_geojson() uses geojsonsf::geojson_sf() for parsing. It is registered as "geojson" for the mime types application/geo+json and application/vdn.geo+json

Additional registered parsers