get_message_body function

Message body

Message body

Transform a list of operation arguments to an http request message body. This method searches for parameters with swagger / openAPI specification in: body or in: formData. body parameters are expected to be R vectors or lists, and are transformed to JSON using jsonlite::toJSON(). formData parameters are treated as is, so must be specified (e.g., using httr::upload_file()) by the caller. Interpretation of formData parameters require that the op_def includes consumes: multipart/form-data.

get_message_body(op_def, body, auto_unbox = TRUE)

Arguments

  • op_def: A list representation of the swagger / openAPI description of the operation.
  • body: A list representation of the operation arguments provided by the user.
  • auto_unbox: automatically unbox() all atomic vectors of length 1. It is usually safer to avoid this and instead use the unbox() function to unbox individual elements. An exception is that objects of class AsIs (i.e. wrapped in I()) are not automatically unboxed. This is a way to mark single values as length-1 arrays.

Returns

A JSON character representation (for body) or list of objects (for formData) representing the parameters x.

  • Maintainer: Marcel Ramos
  • License: MIT + file LICENSE
  • Last published: 2024-09-30