function parseFormData (body, indent, trim) {
  let bodySnippet = '',
    formDataArray = [],
    formDataFileArray = [],
    key,
    value;

  if (_.isEmpty(body)) {
    return bodySnippet;
  }

  _.forEach(body, function (data) {
    key = trim ? data.key.trim() : data.key;
    value = trim ? data.value.trim() : data.value;
    if (!data.disabled) {
      if (data.type === 'file') {
        formDataFileArray.push(`request.files.add(await http.MultipartFile.fromPath('${key}', '${data.src}'));`);
      }
      else {
        formDataArray.push(`${indent}'${sanitize(key)}': '${sanitize(value, trim)}'`);
      }
    }
  });

  if (formDataArray.length > 0) {
    bodySnippet += 'request.fields.addAll({\n';
    bodySnippet += formDataArray.join(',\n');
    bodySnippet += '\n});\n';
  }

  if (formDataFileArray.length > 0) {
    bodySnippet += formDataFileArray.join('\n');
  }

  return bodySnippet;
}
/**
 * Parses form data body from request
 *
 * @param {Object} body form data Body
 * @param {String} indent indentation required for code snippet
 * @param {Boolean} trim indicates whether to trim string or not
 */
Parses form data body from request
@param {Object} body form data Body
@param {String} indent indentation required for code snippet
@param {Boolean} trim indicates whether to trim string or not
Parses form data body from request @param { Object } body form data Body @param { String } indent indentation required for code snippet @param { Boolean } trim indicates whether to trim string or not
function parseFormData (body, indent, trim) {
  let bodySnippet = '',
    formDataArray = [],
    formDataFileArray = [],
    key,
    value;
  if (_.isEmpty(body)) {
    return bodySnippet;
  }
  _.forEach(body, function (data) {
    key = trim ? data.key.trim() : data.key;
    value = trim ? data.value.trim() : data.value;
    if (!data.disabled) {
      if (data.type === 'file') {
        formDataFileArray.push(`request.files.add(await http.MultipartFile.fromPath('${key}', '${data.src}'));`);
      }
      else {
        formDataArray.push(`${indent}'${sanitize(key)}': '${sanitize(value, trim)}'`);
      }
    }
  });
  if (formDataArray.length > 0) {
    bodySnippet += 'request.fields.addAll({\n';
    bodySnippet += formDataArray.join(',\n');
    bodySnippet += '\n});\n';
  }
  if (formDataFileArray.length > 0) {
    bodySnippet += formDataFileArray.join('\n');
  }
  return bodySnippet;
}
function parseFormData ( body , indent , trim ) { let bodySnippet = '' , formDataArray = [ ] , formDataFileArray = [ ] , key , value ; if ( _ . isEmpty ( body ) ) { return bodySnippet ; } _ . forEach ( body , function ( data ) { key = trim ? data . key . trim ( ) : data . key ; value = trim ? data . value . trim ( ) : data . value ; if ( ! data . disabled ) { if ( data . type === 'file' ) { formDataFileArray . push ( ` ${ key } ${ data . src } ` ) ; } else { formDataArray . push ( ` ${ indent } ${ sanitize ( key ) } ${ sanitize ( value , trim ) } ` ) ; } } } ) ; if ( formDataArray . length > 0 ) { bodySnippet += 'request.fields.addAll({\n' ; bodySnippet += formDataArray . join ( ',\n' ) ; bodySnippet += '\n});\n' ; } if ( formDataFileArray . length > 0 ) { bodySnippet += formDataFileArray . join ( '\n' ) ; } return bodySnippet ; }
Parses form data body from request
 @param {Object} body form data Body
 @param {String} indent indentation required for code snippet
 @param {Boolean} trim indicates whether to trim string or not
Parses form data body from request @param { Object } body form data Body @param { String } indent indentation required for code snippet @param { Boolean } trim indicates whether to trim string or not