matcha
matcha copied to clipboard
BUG: Missing ok check on type assertion in HTTP tests
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
This has had no activity for 30 days. It will be closed in 14 days unless updated. Comment or remove the stale label to keep it open.
Closing due to inactivity. Reopen if still relevant.