function normalizeBodyEncoding(encoding) {
  if (!encoding) {
    return 'utf-8';
  }

  switch (encoding.toLowerCase()) {
    case 'utf-8':
    case 'utf8':
      return 'utf-8';
    case 'base64':
      return 'base64';
    default:
      throw new Error(
        `Unsupported encoding: '${encoding}' (only UTF-8 and ` +
          'Base64 are supported)',
      );
  }
}
Returns the encoding as either 'utf-8' or 'base64'. Throws
an error in case any other encoding is provided.

@param {string} encoding