formatting and extra test
Can probably slim down the `ExcludePath` tests.
This commit is contained in:
		
							parent
							
								
									c4f20fff3d
								
							
						
					
					
						commit
						08021429ea
					
				|  | @ -24,6 +24,7 @@ func TestLoggingHandler_ServeHTTP(t *testing.T) { | ||||||
| 		{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", ""}, | 		{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", ""}, | ||||||
| 		{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"}, | 		{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"}, | ||||||
| 		{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", ""}, | 		{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", ""}, | ||||||
|  | 		{logger.DefaultRequestLoggingFormat, "", "/ping", "/ping"}, | ||||||
| 		{"{{.RequestMethod}}", "GET\n", "/foo/bar", ""}, | 		{"{{.RequestMethod}}", "GET\n", "/foo/bar", ""}, | ||||||
| 		{"{{.RequestMethod}}", "GET\n", "/foo/bar", "/ping"}, | 		{"{{.RequestMethod}}", "GET\n", "/foo/bar", "/ping"}, | ||||||
| 		{"{{.RequestMethod}}", "GET\n", "/ping", ""}, | 		{"{{.RequestMethod}}", "GET\n", "/ping", ""}, | ||||||
|  |  | ||||||
|  | @ -182,6 +182,7 @@ func (l *Logger) PrintReq(username, upstream string, req *http.Request, url url. | ||||||
| 	if url.Path == l.excludePath { | 	if url.Path == l.excludePath { | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
| 	duration := float64(time.Now().Sub(ts)) / float64(time.Second) | 	duration := float64(time.Now().Sub(ts)) / float64(time.Second) | ||||||
| 
 | 
 | ||||||
| 	if username == "" { | 	if username == "" { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue