parse_http {webutils} | R Documentation |
Parse http request
Description
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
(parse_query
),
multipart/form-data
(parse_multipart
) and
application/json
(fromJSON
).
Usage
parse_http(body, content_type, ...)
Arguments
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 |
Examples
# 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)
[Package webutils version 1.2.0 Index]