parseRequestFormData()function

parseRequestFormData(request: Request, caller: AnyCaller = parseRequestFormData): Promise<FormData | undefined>
ParamType
requestRequest
The Request whose form-data body to parse. required
callerAnyCaller
Identity of the calling function for error attribution. Defaults to parseRequestFormData
Return
Promise<FormData | undefined>
The parsed FormData.
Throws
RequestError
If the request body is not valid multipart form-data.

Parse FormData from an HTTP Request, or return undefined when the request has no body.

Examples

const form = await parseRequestFormData(request);