Skip to content

[Runtime Reliability] Undefined headers variable in getHeaders() causes runtime ReferenceErrors #92

@vangelif

Description

@vangelif

File: packages/better-fetch/src/utils.ts:237-238

Fix: Replace the bare headers reference at lines 237–238 with options?.headers. The check should read: if (options?.headers?.has?.("content-type") && options.headers.get("content-type") === "application/x-www-form-urlencoded").

Also add a unit test that exercises this branch with a FormData body to prevent regression.


This issue was identified by an agentic audit tool. If this doesn't apply to your project, feel free to close it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions