parse_media: Parse a media type.

Description Usage Details Examples

View source: R/media-parse.r

Description

Parsed according to RFC 2616, as at http://pretty-rfc.herokuapp.com/RFC2616#media.types.

Usage

1

Details

A simplified minimal EBNF is:

Examples

1
2
3
4
parse_media("text/plain")
parse_media("text/plain; charset=utf-8")
parse_media("text/plain; charset=\"utf-8\"")
parse_media("text/plain; randomparam=\";=;=\"")

Example output

$complete
[1] "text/plain"

$type
[1] "text"

$subtype
[1] "plain"

$params
list()

$complete
[1] "text/plain"

$type
[1] "text"

$subtype
[1] "plain"

$params
$params$charset
[1] "utf-8"


$complete
[1] "text/plain"

$type
[1] "text"

$subtype
[1] "plain"

$params
$params$charset
[1] "utf-8"


$complete
[1] "text/plain"

$type
[1] "text"

$subtype
[1] "plain"

$params
$params$randomparam
[1] ";=;="

httr documentation built on Aug. 20, 2017, 5:06 p.m.