Skip to content

Native Node.js fetch fails with attempting DELETE requests #506

Closed
octokit/endpoint.js
#354
@rdmurphy

Description

@rdmurphy

Hello! This possibly overlaps with @octokit/endpoint — we noticed today after updating to the latest version of @octokit/rest (v19) that any API requests that we make that result in a DELETE request (in our case it's delete a label) now fail when they are ran using Node v18. We think we tracked it down to how @octokit/request now opts into using the native Fetch API.

It appears that node-fetch and undici-fetch (AKA native Node.js fetch) feel differently about DELETE requests that set content-length: 0 (which happens via @octokit/endpoint) without adding a body. node-fetch allows it to happen, undici-fetch throws an error with the UND_ERR_REQ_CONTENT_LENGTH_MISMATCH code.

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