(t *testing.T)
| 1960 | } |
| 1961 | |
| 1962 | func Test301Redirect(t *testing.T) { |
| 1963 | m := make(http.Header) |
| 1964 | |
| 1965 | func1 := func(w http.ResponseWriter, r *http.Request) {} |
| 1966 | func2 := func(w http.ResponseWriter, r *http.Request) {} |
| 1967 | |
| 1968 | r := NewRouter() |
| 1969 | r.HandleFunc("/api/", func2).Name("func2") |
| 1970 | r.HandleFunc("/", func1).Name("func1") |
| 1971 | |
| 1972 | req, _ := http.NewRequest("GET", "http://localhost//api/?abc=def", nil) |
| 1973 | |
| 1974 | res := TestA301ResponseWriter{ |
| 1975 | hh: m, |
| 1976 | status: 0, |
| 1977 | } |
| 1978 | r.ServeHTTP(&res, req) |
| 1979 | |
| 1980 | if "http://localhost/api/?abc=def" != res.hh["Location"][0] { |
| 1981 | t.Errorf("Should have complete URL with query string") |
| 1982 | } |
| 1983 | } |
| 1984 | |
| 1985 | func TestSkipClean(t *testing.T) { |
| 1986 | func1 := func(w http.ResponseWriter, r *http.Request) {} |
nothing calls this directly
no test coverage detected
searching dependent graphs…