code: func decodeBody(req *http.Request, out interface{}, cb func(interface{}) error) error {
  	// This generally only happens in tests since real HTTP requests set
  	// a non-nil body with no content. We guard against it anyways to prevent
  	// a panic. The EOF response is the same behavior as an empty reader.
  	if req.Body == nil {
  		return io.EOF
  	}
  
  	var raw interface{}
  	dec := json.NewDecoder(req.Body)
  	if err := dec.Decode(&raw); err != nil {
  		return err
  	}
  
  	// Invoke the callback prior to decode
  	if cb != nil {
  		if err := cb(raw); err != nil {
  			return err
  		}
  	}
  
  	decodeConf := &mapstructure.DecoderConfig{
  		DecodeHook: mapstructure.ComposeDecodeHookFunc(
  			mapstructure.StringToTimeDurationHookFunc(),
  			stringToReadableDurationFunc(),
  		),
  		Result: &out,
  	}
  
  	decoder, err := mapstructure.NewDecoder(decodeConf)
  	if err != nil {
  		return err
  	}
  
  	return decoder.Decode(raw)
  }
docs: // decodeBody is used to decode a JSON request body