-
Notifications
You must be signed in to change notification settings - Fork 0
How do I convert a Handle to a HandleFunc?
pikachule edited this page Sep 12, 2017
·
1 revision
https://stackoverflow.com/questions/27614932/how-do-i-convert-a-handle-to-a-handlefunc
github.com/dchest/captcha
github.com/gorilla/muxou can convert the http.Handler h to a http.HandlerFunc using the method expression:
h.ServeHTTPInstead of converting to a HandlerFunc, you can register the Handler directly using the route Handler method:
router.Methods("GET").Path("/captcha/").Handler(captcha.Server(captcha.StdWidth, captcha.StdHeight))Based on your comments and edits, I think you want a prefix match instead of an exact match:
router.Methods("GET").PathPrefix("/captcha/").Handler(captcha.Server(captcha.StdWidth, captcha.StdHeight))