Skip to content

Node.js build (form-data) rejects WHATWG Blob — TypeScript types should accept Buffer #83

@lfgcampos

Description

@lfgcampos

Problem:

The TypeScript type AddAttachment declares value: string | Blob | Readable, which leads users to pass a WHATWG Blob. However, the Node.js bundle (dist/TestRail.node.js) injects const FormData = require('form-data') at the top, so it always uses the form-data npm package — which does not support WHATWG Blob. Passing a Blob causes TypeError: source.on is not a function because form-data mistakes the Blob for a Node.js stream.


Fix suggestion:

Either add Buffer to the AddAttachment type for the Node.js build, or document that the form-data package is used under the hood and that Blob must be converted to a Buffer or Readable stream before passing to attachment methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions