code: func buildEncodingDefinition(encoding bool, args ...interface{}) *design.EncodingDefinition {
  	var dsl func()
  	var ok bool
  	funcName := "Consumes"
  	if encoding {
  		funcName = "Produces"
  	}
  	if len(args) == 0 {
  		dslengine.ReportError("missing argument in call to %s", funcName)
  		return nil
  	}
  	if _, ok = args[0].(string); !ok {
  		dslengine.ReportError("first argument to %s must be a string (MIME type)", funcName)
  		return nil
  	}
  	last := len(args)
  	if dsl, ok = args[len(args)-1].(func()); ok {
  		last = len(args) - 1
  	}
  	mimeTypes := make([]string, last)
  	for i := 0; i < last; i++ {
  		var mimeType string
  		if mimeType, ok = args[i].(string); !ok {
  			dslengine.ReportError("argument #%d of %s must be a string (MIME type)", i, funcName)
  			return nil
  		}
  		mimeTypes[i] = mimeType
  	}
  	d := &design.EncodingDefinition{MIMETypes: mimeTypes, Encoder: encoding}
  	if dsl != nil {
  		dslengine.Execute(dsl, d)
  	}
  	return d
  }
docs: // buildEncodingDefinition builds up an encoding definition.