Open ntbosscher opened 5 years ago
My usage here isn't a very good use case. Please ignore it.
Nevertheless, it seems to me that .Lookup should function almost the same as .ServeHTTP() such that you could implement your own ServeHTTP() with the following code
MyServeHTTP(w, r) {
handler, params, _ := router.Lookup(r.Method, r.Path)
handler(w, r, params)
}
I've built some extras around httprouter which would work much nicer if
Lookup(method, path)
would include the.HandleOPTIONS
functionality thatServeHTTP
has.Use Case
I have user permission based routing. When an options request comes in, it doesn't work the way I'd like it to. Here's an example.