Skip to content

BUG: Missing ok check on type assertion in HTTP tests #615

@andrinoff

Description

@andrinoff

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

  1. Modify test to return non-table value for headers
  2. Test panics instead of failing gracefully
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions