Пример #1
0
/*
InfoTask Run method.
*/
func (i *InfoTask) Run(r *http.Request, data map[string]interface{}) (response *Response) {

	endpoints := []*Response{}

	// add tasks to result
	for _, route := range i.routes {
		r := NewResponse(http.StatusOK)
		r.AddValue("path", route.Path)
		r.AddValue("method", route.Method)
		if len(route.TaskConfig.Authorizers) > 0 {
			r.AddValue("authorizers", route.TaskConfig.Authorizers)
		}
		r.AddValue("type", route.TaskConfig.Type)
		if route.TaskConfig.Description != "" {
			r.AddValue("description", route.TaskConfig.Description)
		}
		endpoints = append(endpoints, r.StripStatusData())
	}

	return NewResponse(http.StatusOK).Result(map[string]interface{}{
		"version":   i.version,
		"endpoints": endpoints,
	})
}