negroni icon indicating copy to clipboard operation
negroni copied to clipboard

why the use of http.HandlerFunc

Open rickb777 opened this issue 7 years ago • 2 comments

Why does Negroni use both http.Handler and http.HandlerFunc in its API? It's rather inconsistent.

func New(handlers ...Handler) *Negroni

compared with the third parameter in

type Handler interface {
	ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
}

rickb777 avatar Mar 28 '17 15:03 rickb777

negroni.Handler interface will have

  ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.Handler)

instead of http.HandlerFunc.

and we 'll need a new release. But this will affect the consumers when they upgrade. I can change it and raise a PR if owners/maintainers give it a go.

devdinu avatar Apr 08 '17 06:04 devdinu

I agree that it is a little inconsistent, but I hesitate to modify this part of the API until a version 2 given the severity of the breaking change.

jszwedko avatar Apr 24 '17 21:04 jszwedko