Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typings for field name #350

Open
topd5 opened this issue Nov 19, 2023 · 1 comment
Open

Typings for field name #350

topd5 opened this issue Nov 19, 2023 · 1 comment

Comments

@topd5
Copy link

topd5 commented Nov 19, 2023

Hi!
@types/busboy has this typing:

file: (name: string, stream: Readable, info: FileInfo) => void;

But if field name is not set, then it comes as undefined, not as string in this callback
4busboy

HTTP example:

> POST /api/files/upload HTTP/1.1
> Host: 127.0.0.1:7100
> Cookie: user_token=del
> Content-Type: multipart/form-data; boundary=X-INSOMNIA-BOUNDARY
> User-Agent: insomnia/2023.5.8
> Accept: */*
> Content-Length: 215

| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="xxx"
| blah
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name=""; filename="1.txt"
| Content-Type: text/plain
| 555
| --X-INSOMNIA-BOUNDARY--
    bb.on('file', (name, file, info) => {
      console.log('name', name);
      console.log(typeof name); // undefined
@mscdex
Copy link
Owner

mscdex commented Nov 19, 2023

I don't maintain typings for any of my projects, so you would need to contact whoever is maintaining those for busboy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants