form method

Future<FormData> form([
  1. dynamic onContentTypeError()?
])

covert the form data to FormData class that contains the fields and the files if exist

Implementation

Future<FormData> form([Function()? onContentTypeError]) async {
  if (contentType?.mimeType == MimeTypes.urlEncodedForm) {
    return await _form();
  } else if (contentType?.mimeType == MimeTypes.multipartForm) {
    return await _multipartForm();
  }
  if (onContentTypeError != null) {
    onContentTypeError();
    return FormData({}, {});
  }
  throw HTTPException(415, "Cannot decode the body of the request");
}