git.iko.soy/typeable/oauth2-proxy
on master help sign in
formatting and extra test
0802142Karl Skewes
logging_handler_test.go+1
@@ -24,6 +24,7 @@ func TestLoggingHandler_ServeHTTP(t *testing.T) {
24 {logger.DefaultRequestLoggingFormat, fmt.Sprintf("127.0.0.1 - - [%s] test-server GET - \"/foo/bar\" HTTP/1.1 \"\" 200 4 0.000\n", logger.FormatTimestamp(ts)), "/foo/bar", ""},
24 {logger.DefaultRequestLoggingFormat, fmt.Sprintf("127.0.0.1 - - [%s] test-server GET - \"/foo/bar\" HTTP/1.1 \"\" 200 4 0.000\n", logger.FormatTimestamp(ts)), "/foo/bar", ""},
25 {logger.DefaultRequestLoggingFormat, fmt.Sprintf("127.0.0.1 - - [%s] test-server GET - \"/foo/bar\" HTTP/1.1 \"\" 200 4 0.000\n", logger.FormatTimestamp(ts)), "/foo/bar", "/ping"},
25 {logger.DefaultRequestLoggingFormat, fmt.Sprintf("127.0.0.1 - - [%s] test-server GET - \"/foo/bar\" HTTP/1.1 \"\" 200 4 0.000\n", logger.FormatTimestamp(ts)), "/foo/bar", "/ping"},
26 {logger.DefaultRequestLoggingFormat, fmt.Sprintf("127.0.0.1 - - [%s] test-server GET - \"/ping\" HTTP/1.1 \"\" 200 4 0.000\n", logger.FormatTimestamp(ts)), "/ping", ""},
26 {logger.DefaultRequestLoggingFormat, fmt.Sprintf("127.0.0.1 - - [%s] test-server GET - \"/ping\" HTTP/1.1 \"\" 200 4 0.000\n", logger.FormatTimestamp(ts)), "/ping", ""},
27+ {logger.DefaultRequestLoggingFormat, "", "/ping", "/ping"},
27 {"{{.RequestMethod}}", "GET\n", "/foo/bar", ""},
28 {"{{.RequestMethod}}", "GET\n", "/foo/bar", ""},
28 {"{{.RequestMethod}}", "GET\n", "/foo/bar", "/ping"},
29 {"{{.RequestMethod}}", "GET\n", "/foo/bar", "/ping"},
29 {"{{.RequestMethod}}", "GET\n", "/ping", ""},
30 {"{{.RequestMethod}}", "GET\n", "/ping", ""},
pkg/logger/logger.go+1
@@ -182,6 +182,7 @@ func (l *Logger) PrintReq(username, upstream string, req *http.Request, url url.
182 if url.Path == l.excludePath {
182 if url.Path == l.excludePath {
183 return
183 return
184 }
184 }
185+
185 duration := float64(time.Now().Sub(ts)) / float64(time.Second)
186 duration := float64(time.Now().Sub(ts)) / float64(time.Second)
186
187
187 if username == "" {
188 if username == "" {