func()

in pkg/api/api.go [133:156]


func (h *APIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	time.Sleep(h.Delay)

	// required for official clients to recognize this as a valid endpoint.
	w.Header().Set("X-Elastic-Product", "Elasticsearch")

	switch {
	case r.Method == http.MethodGet && r.URL.Path == "/":
		h.Root(w, r)
		return
	case r.Method == http.MethodPost && r.URL.Path == "/_bulk":
		h.Bulk(w, r)
		return
	case r.Method == http.MethodGet && r.URL.Path == "/_license":
		h.License(w, r)
		return
	case r.Method == http.MethodGet && r.URL.Path == "/_history":
		h.History(w, r)
		return
	default:
		w.Write([]byte("{\"tagline\": \"You Know, for Testing\"}"))
		return
	}
}