func TestRouting(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Println(r.URL.Path) fmt.Println(r.URL.String()) r.URL.Path = strings.TrimPrefix(r.URL.Path, "/t") fmt.Println(r.URL.Path) fmt.Println(r.URL.String()) })) util.HTTPGet("%s/t/b/c", ts.URL) }
func TestDefaultSessionMux(t *testing.T) { mux := NewSessionMux2("/t") mux.HFunc("^.*$", func(hs *HTTPSession) HResult { hs.SetVal("abc", "123") hs.StrVal("abc") hs.SetVal("abc", nil) hs.StrVal("abc") hs.S.Flush() return HRES_RETURN }) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { mux.ServeHTTP(w, r) })) util.HTTPGet("%s/t", ts.URL) }