test correction and Proxy func addition

This commit is contained in:
2024-11-03 22:24:28 +05:30
parent f72529aea5
commit eda7c79ab6
2 changed files with 39 additions and 28 deletions

View File

@@ -141,6 +141,15 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
panic("mux: method ServeHTTP called on nil")
}
r.mux.ServeHTTP(w, req)
}
// Proxy are request and
func (r *Router) Proxy(w http.ResponseWriter, req *http.Request) {
if r == nil {
panic("mux: method ServeHTTP called on nil")
}
h, pattern := r.mux.Handler(req)
if pattern == "" {
http.Error(w, "Not Found", http.StatusNotFound)