In net/http, http.HandlerFunc is a defined function type. Which statement about it is correct?
- aIt adapts any func(http.ResponseWriter, *http.Request) into an http.Handler via a ServeHTTP method✓
- bIt requires the wrapped function to also implement Read and Write methods
- cIt only works for functions that return an error value
- dIt automatically registers the function with the default ServeMux
Explanation:http.HandlerFunc(f) is a type with a ServeHTTP method that just calls f(w, r); it's the standard adapter for turning a plain function into an http.Handler. It does not require Read/Write, does not require an error return, and does not register anything by itself — http.HandleFunc or mux.HandleFunc does the registering.