Learn R Programming

whapi (version 0.0.2)

whapi_parse_body: Parse the raw body of a Plumber request

Description

Attempts to parse the body of a Plumber req object. Supports both req$body (already parsed) and req$bodyRaw (raw binary). If the body looks like JSON ({...} or [...]), it tries to parse it with jsonlite::fromJSON. Otherwise, it returns the raw text.

Usage

whapi_parse_body(req)

Value

A list representing the parsed body, or NULL if no body is found.

Arguments

req

A Plumber request object (list-like).