index.js
function normalize (type) {
  if (typeof type !== 'string') {
    // invalid type
    return false
  }

  switch (type) {
    case 'urlencoded':
      return 'application/x-www-form-urlencoded'
    case 'multipart':
      return 'multipart/*'
  }

  if (type[0] === '+') {
    // "+json" -> "*/*+json" expando
    return '*/*' + type
  }

  return type.indexOf('/') === -1
    ? mime.lookup(type)
    : type
}
function normalize (type) {
  if (typeof type !== 'string') {
    // invalid type
    return false
  }

  switch (type) {
    case 'urlencoded':
      return 'application/x-www-form-urlencoded'
    case 'multipart':
      return 'multipart/*'
  }

  if (type[0] === '+') {
    // "+json" -> "*/*+json" expando
    return '*/*' + type
  }

  return type.indexOf('/') === -1
    ? mime.lookup(type)
    : type
}
function normalize ( type ) { if ( typeof type !== 'string' ) { // invalid type return false } switch ( type ) { case 'urlencoded' : return 'application/x-www-form-urlencoded' case 'multipart' : return 'multipart/*' } if ( type [ 0 ] === '+' ) { // "+json" -> "*/*+json" expando return '*/*' + type } return type . indexOf ( '/' ) === - 1 ? mime . lookup ( type ) : type }
Normalize a mime type.
If it's a shorthand, expand it to a valid mime type.

In general, you probably want:

var type = is(req, ['urlencoded', 'json', 'multipart']);

Then use the appropriate body parsers.
These three are the most common request body types
and are thus ensured to work.

@param {String} type
@private
Normalize a mime type . If it s a shorthand expand it to a valid mime type .