(t *testing.T)
| 1956 | } |
| 1957 | |
| 1958 | func TestDisableAccessLog(t *testing.T) { |
| 1959 | var buf bytes.Buffer |
| 1960 | al := logging.NewAccessLogger(logging.Options{ |
| 1961 | AccessLogOutput: &buf}) |
| 1962 | |
| 1963 | response := "7 bytes" |
| 1964 | |
| 1965 | u, _ := url.ParseRequestURI("https://www.example.org/hello") |
| 1966 | r := &http.Request{ |
| 1967 | URL: u, |
| 1968 | Method: "GET", |
| 1969 | Header: http.Header{"Connection": []string{"token"}}} |
| 1970 | w := httptest.NewRecorder() |
| 1971 | |
| 1972 | doc := fmt.Sprintf(`hello: Path("/hello") -> status(%d) -> inlineContent("%s") -> <shunt>`, http.StatusTeapot, response) |
| 1973 | |
| 1974 | tp, err := newTestProxyWithParams(doc, Params{ |
| 1975 | AccessLogDisabled: true, |
| 1976 | AccessLogger: al, |
| 1977 | }) |
| 1978 | if err != nil { |
| 1979 | t.Fatal(err) |
| 1980 | } |
| 1981 | defer tp.close() |
| 1982 | |
| 1983 | tp.proxy.ServeHTTP(w, r) |
| 1984 | |
| 1985 | if buf.Len() != 0 { |
| 1986 | t.Error("failed to disable access log") |
| 1987 | } |
| 1988 | } |
| 1989 | |
| 1990 | func TestDisableAccessLogWithFilter(t *testing.T) { |
| 1991 | for _, ti := range []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…