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()usesreadr::read_csv()for parsing. It is registered as"csv"for the mime typesapplication/csv,application/x-csv,text/csv, andtext/x-csvparse_multipartuseswebutils::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 typemultipart/*parse_octet()passes the raw data through unchanged. It is registered as"octet"for the mime typeapplication/octet-streamparse_rds()usesunserialize()for parsing. It is registered as"rds"for the mime typeapplication/rdsparse_feather()usesarrow::read_feather()for parsing. It is registered as"feather"for the mime typesapplication/vnd.apache.arrow.fileandapplication/featherparse_parquet()usesarrow::read_parquet()for parsing. It is registered as"parquet"for the mime typeapplication/vnd.apache.parquetparse_text()usesrawToChar()for parsing. It is registered as"text"for the mime typestext/plainandtext/*parse_tsv()usesreadr::read_tsv()for parsing. It is registered as"tsv"for the mime typesapplication/tab-separated-valuesandtext/tab-separated-valuesparse_yaml()usesyaml::yaml.load()for parsing. It is registered as"yaml"for the mime typestext/vnd.yaml,application/yaml,application/x-yaml,text/yaml, andtext/x-yamlparse_geojson()usesgeojsonsf::geojson_sf()for parsing. It is registered as"geojson"for the mime typesapplication/geo+jsonandapplication/vdn.geo+json
Additional registered parsers
reqres::parse_json()is registered as "json" for the mime typesapplication/jsonandtext/jsonreqres::parse_queryform()is registered as "form" for the mime typeapplication/x-www-form-urlencodedreqres::parse_xml()is registered as "xml" for the mime typesapplication/xmlandtext/xmlreqres::parse_html()is registered as "html" for the mime typetext/html