parse_http | R Documentation |
Parse the body of a http request, based on the Content-Type
request
header. Currently supports the three most important content types:
application/x-www-form-urlencoded
with parse_query()
,
multipart/form-data
with parse_multipart()
, and application/json
with jsonlite::fromJSON()
.
parse_http(body, content_type, ...)
body |
request body of the http request |
content_type |
content-type http request header as specified by the client |
... |
additional arguments passed to parser function |
# Parse json encoded payload:
parse_http('{"foo":123, "bar":true}', 'application/json')
# Parse url-encoded payload
parse_http("foo=1%2B1%3D2&bar=yin%26yang", "application/x-www-form-urlencoded")
## Not run: use demo app to parse multipart/form-data payload
demo_rhttpd()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.