updated hws.ThrowError to not return an error and log it to console instead
fixed errors_test fixed tests
This commit is contained in:
@@ -169,7 +169,7 @@ func Test_LogFatal(t *testing.T) {
|
||||
// Note: We cannot actually test Fatal() as it calls os.Exit()
|
||||
// Testing this would require subprocess testing which is overly complex
|
||||
// These tests document the expected behavior and verify the function signatures exist
|
||||
|
||||
|
||||
t.Run("LogFatal with nil logger prints to stdout", func(t *testing.T) {
|
||||
_, err := hws.NewServer(&hws.Config{
|
||||
Host: "127.0.0.1",
|
||||
@@ -197,7 +197,7 @@ func Test_LoggerIgnorePaths(t *testing.T) {
|
||||
|
||||
err := server.LoggerIgnorePaths("http://example.com/path")
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "Invalid path")
|
||||
assert.Contains(t, err.Error(), "invalid path")
|
||||
})
|
||||
|
||||
t.Run("Invalid path with host", func(t *testing.T) {
|
||||
@@ -207,7 +207,7 @@ func Test_LoggerIgnorePaths(t *testing.T) {
|
||||
err := server.LoggerIgnorePaths("//example.com/path")
|
||||
assert.Error(t, err)
|
||||
if err != nil {
|
||||
assert.Contains(t, err.Error(), "Invalid path")
|
||||
assert.Contains(t, err.Error(), "invalid path")
|
||||
}
|
||||
})
|
||||
|
||||
@@ -217,7 +217,7 @@ func Test_LoggerIgnorePaths(t *testing.T) {
|
||||
|
||||
err := server.LoggerIgnorePaths("/path?query=value")
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "Invalid path")
|
||||
assert.Contains(t, err.Error(), "invalid path")
|
||||
})
|
||||
|
||||
t.Run("Invalid path with fragment", func(t *testing.T) {
|
||||
@@ -226,7 +226,7 @@ func Test_LoggerIgnorePaths(t *testing.T) {
|
||||
|
||||
err := server.LoggerIgnorePaths("/path#fragment")
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "Invalid path")
|
||||
assert.Contains(t, err.Error(), "invalid path")
|
||||
})
|
||||
|
||||
t.Run("Valid paths", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user