Describe the bug
In plugin/http_test.go line 58, type assertion lacks ok check:
headers := tbl.RawGetString("headers").(*lua.LTable)
If headers field isn't *lua.LTable, panic occurs instead of proper error.
To reproduce
- Modify test to return non-table value for headers
- Test panics instead of failing gracefully
- No useful error message
Expected behavior
Use safe type assertion:
headersVal := tbl.RawGetString("headers")
headers, ok := headersVal.(*lua.LTable)
if !ok {
t.Fatalf("expected headers to be table, got %T", headersVal)
}
Screenshots
N/A
Additional context
- File:
plugin/http_test.go
- Line: 58
- Severity: Medium - test crashes vs proper failure
- Fix complexity: Easy - add ok check pattern
Describe the bug
In
plugin/http_test.goline 58, type assertion lacksokcheck:If headers field isn't
*lua.LTable, panic occurs instead of proper error.To reproduce
Expected behavior
Use safe type assertion:
Screenshots
N/A
Additional context
plugin/http_test.go